In this article we will discuss about how to hide the save button. You may wonder why we should hide the save button. We will hide the save button to avoid one big issue of the survey.
If you have not gone through the survey articles, I would recommend you to read them all first before you read further.
Creating and working with Survey in SharePoint - Part 1
Creating and working with Survey in SharePoint - Part 2
Creating and working with Survey in SharePoint - Part 3
Creating and working with Survey in SharePoint - Part 4
When you have any question that has branching, SharePoint automatically places the next question on the second page and gives you an option to save your response so that later you can edit it. If you have the long survey that has many branching questions, then SharePoint does this splitting of page between the questions. Here we have one big problem. When responder saves the response, you will see that number of response increases. If you have five responders and all five of them have saved the respond, not completed the respond, then first thing you will notice is you can see total number of responses as five, but when you will actually go to the survey and find out then you won’t see even a single response. So where are all those responses?
Well, answer to this question is really simple. Even though you have full rights on survey or even you are a site administrator or site collection administrator, nobody can see those responses except a person who has saved the response. Only he can see his saved response. So bottom line is check columns named “Completed” in “All Responses” view, you will find only those responses whose status is yes. If a person has saved response, he will see status as “no” in “Completed” column.
Now why we are talking about hiding the save button is because there can be a reason where in you want responders to respond the survey in specific days. If they don’t then you want to send mail to them one more time to indicate that look, you need to fill this. Now to know this that how many people have not responded to survey yet, is don’t allow to save the response so that you can have exact number of responses.
Ok, so let us go ahead and add the content editor web part in every page of your questions, so that save button doesn’t appear on each and every page of survey. So now responder has no choice but to fill in the survey at one go.
In content editor web part, place the following code.
<script language="JavaScript">
var ClassName;
ClassName = 'ms-toolbar';
var elements = new Array();
var elements = document.getElementsByTagName('td');
for(var e=0;e<elements.length;e++)
{
if(elements[e].className == ClassName)
{
elements[e].innerHTML = elements[e].innerHTML.replace('value=Save','value=Save style=visibility:hidden ');
}
}
</script>
Your job is done. Now see the effect of above code.
That's it.
37 comments:
hi,
this javascript work in all browser ?
thanks !
we tried in IE only
which browser are trying?
I like the idea, but if a person were to navigate to another page or close the browser before they completed the survey and after they clicked Next at least once, they would still have a saved survey, without ever having clicked the Save button. It would be nice if permissions could be set so that both complete and incomplete surveys were shown.
Is it possible to obtain the answer to a previous question, so that you can include it in the text of a question that follows?
e.g. Question [1] might ask "What system do you use most?" (choices are Windows, Mac, Linux, etc)
If your answer was "Windows" and then you click Next, can we insert the string "Windows" into question [2], so it now reads: "How many hours per day do you use Windows?"
thanks.
I think I must have missed a step in your instructions. On what screen do I add this content editor web part? On the main survey page, where I have the option to respond to the survey, I am able to click site actions --> edit page, but when I go into the answering of the survey itself and each page of the survey, I do not see an "edit page" option. Only "Site Settings" and "Create" appear on these pages. Am I going to the wrong place? I am very anxious to figure out how to do this. I am losing many results for my survey from users inadvertantly "saving" the survey instead of finishing it and this is a perfect solution.
I want to show this survey list as a web part on my site's homepage but when it give graphical summary of responses, my page gets too long which doenot look good, is there any other way, i can show just link of 'view results in graphical ' or anything like that.
@Anonymous:
Please visit this link http://www.sharepointkings.com/2008/05/how-to-edit-list-forms-like-newformaspx.html
I'm sorry but I can't quite figure out how to do this. I went to the link explaining how to edit listforms but I can only get it to work on my main survey page, where you choose to respond to the survey. The instructions say to add the web part to every page of the survey questions but when I go to survey settings and to the question with the branching, then adding &ToolPaneView=2 and doing a refresh doesn't have any affect. What am I doing wrong? Thanks!
Hi, I've tried the instructions you posted including the link which explained how to get the Edit Page to appear so you can add the webpart. I was able to add
Teresa Boyd
Is there a way to send an email notification to the user that responded to the survey. When we create a new project page, we have the option of sending users welcome messages. Is there something similar for surveys?
Regards,
Sharepoint Beginner
Yes, There is a way to do this.
Just attach the ItemAdded handler and send email to respective person in that event.
i think this is super..but for some reason, it isnt working for me. I have added the content editor webpart to my first page and it is still showing the save button. I dont know what i am doing wrong :(. But i need this resolved.
there must be something missing in javascript.
otherwise its working for all.
The java script is not working for me either. I've added the content editor to the survey page, pasted the HTML you suggest into the Source Editor, but no change.
Any ideas? Thanks!
just tried alert first
if it is working then in look and after getting object try to alert the value
that's the only way to debug this king of javascript
we tried in firefox and crome also javascript is working for us.
good luck!!!
Yay! Got it working finally. What I found you needed to do was to add &ToolPaneView=2 to the end of the url on the first page of your survey, which allows you add the content editor web part.
Now, what you need to do is to add that web part to the bottom of your page and add the javascript posted on this page. Then it should work - adding the web part to the top of the page never removed the save button for me.
Thanks everyone for the help!
Brian from Ireland.
@iGibbo, Brian from Ireland,
If finally it is working then enjoy!!!
Thanks,
Sharepoint Kings Team
Can someone show me how I could possibly have the next button redirect the person taking the survey to a thankyou page? I do not want the user going to the survey results page.
I would like to redirect a person to a thank you page upon completion of the survey instead of them going to the survey results. Is there a way to do this with javascript as was done with the save button?
It might have been asked but I havent seen it. Anyway to add pictures in the survey or add them via html? I really need this.
cory church,
you can use some place holder as shown in sequence of post on survey, and replace it from javascript by image path. with IMG tag with source as you picture url.
Hope this helps.
I want to be notified when someone responds to the survey. The alert only sends if they "modify" an existing response, not if a new response is created.
How can that be done?
@Anonymous,
Use out of the box alert from survey and set "Existing items are modified"
bryce,
you can change source URL then you will be redirected to the page you want.
now its your call how you change.
Marriner,
sorry for publishing late,
to answer your question, that is not possible directly and not way to do it in sharepoint.
but if you have to do it then you can save answer in cookie by jquery or javascript and check data on next question and replace place holder and so on...
but suggesting not to do that as it might be west of time.
Thanks,
Sharepoint kings team
Hi SK,
This si a brilliant series of articles - thank you so much!
I have a question about the repsonse you gave to an earlier question:
Bryce said: I would like to redirect a person to a thank you page upon completion of the survey instead of them going to the survey results. Is there a way to do this with javascript as was done with the save button?
SK said: You can change source URL then you will be redirected to the page you want. now its your call how you change.
My question: Change what URL, where and how? (because this is exactly what I need to do)
Fiona,
on the Survey page check URL
you will find "Source=...." as query string and after button click you will be redirected to that URL.
you can change the SOURCE URL and open the page again and press button you will be redirected to that URL.
not its your call how to change it.
you can change the link it self from where you are coming from this page.
This series of posts is really useful. To make them more useful still, it would be great if you include at the top of each page a quick summary of what the post will cover. Use appropriate keywords to make it easier to find these excellent resources from everyone's favourite search engine!
Anonymous,
Thanks for suggestion but we are more in to technical stuff and rather then decorating we are more into resolving problems. we will defiantly will follow your suggestion in our upcoming post(s).
We are using SharePoint 2010 and are trying to hide the "Save and Close" button. We pasted the code into the content editor webpart and added it to the newform.aspx and editform.aspx but is still showing the "Save and Close" button. We're not sure what we're doing wrong. Could you please help?
santhi,
just check view source how the button renders and find out how you get that element in javascript
put debug on every step to check where its breaking or to check if it is firing at all or not.
Hi,
Is there a way where I can take all these responses and cummulate them to show it as a dashboard on my main page..
say if 10 users respond as 50% and 10 as 25% then my dashboard will just show the average or cummalative response.
Thanks
Kapil,
that is not possible by default.
but if you have to then you can create a custom web part and show it.
I would prefer a solution that need not be deployed..
any OOTB solution with designer?
Thanks
Kapil, any ootb is not available for your situation as you situation is a little dicey, but not sure any feature of SPD can help you.
Hi, thanks so much for these articles. These are very helpful and you guys are really smart. I am wondering if you can provide any information whether we can open an alert or rollover with a message instead of a link to a URL like you mentioned.
I tried using the using
onClick="alert('');return false"
and
onMouseOver="window.status='what is pahoehoe?';return true" replacement codes for this with no luck. I am not familiar with script much so I might have done something wrong there. Can you please help?
@Vamsi, you are going in right direction. we don't know your exact requirement but we guess you are not able to find exact object to set onclick event.
have a little google on jquery basics it will be fun actually :)
best of luck :)
Post a Comment