Archive

Posts Tagged ‘Display thank you after survey is filled’

Display A Thank You Page After A Survey Is Filled

June 6th, 2011 Abed Khooli 3 comments

The survey list did not get much of a facelift since 2007. In fact, it still uses the old list settings interface as opposed to ribbon enabled lists. After the user submits (or completes) the survey, s/he is sent to the default page which is usually the summary results. People have used the source=encoded url parameter in the address to redirect users to a certain url after the survey is completed. So, instead of leaving things at default, you could add that parameter to the url of the NewForm.aspx and may be have this as a link for users to click on instead of the typical Respond To This Survey link (ex. from an e-mail message or even an announcements list). Of course, it is easy to adjust the url and remove the ?source=url(encoded). The other issue is if a survey has page breaks. After the first page is filled, the next page will have a different url: EditForm.aspx and stays so till the survey is finished. These and other reporting issues (you get an extra quasi-question called Content Type in the graphical view!)  may convince you to either seek third party tools or use InfoPath if enabled (or supported) in your farm.
There is a work-around for the additional content type question (using JQuery). Here, I will also use JQuery to display a thank you page after the survey is completed – for the sake of enhanced user experience.
You can add your thank you page as html or aspx or even a web part page. Let’s say we have a nice paragraph praising the user for their input and a link to the home of the current site (with target=_top to break out of the dialog, even if this is not XHTML compliant). You would edit the NewForm if your survey is one page but here we will deal with a survey that has page breaks, so we edit the EditForm.aspx and add a CEWP. Could not edit the source, so linked the .js file (uploaded to a library) from the web part properties.
What do we write in that file? If you inspect the Finish button, you will find it has an OnClick event that posts back after a validation check. We take the id of this button and in our js file we unbind the click event and bind a modified version of it.

Substitute your id and your page url, replace nice quotes with plain text ones (if you are copying). Now you have your custom thank you page. Notice I am using the latest jq library (not a must) and no need to link from the Internet – you can put it in a document library and link it from there.