0

I am using Sharepoint 2013 foundation. I have created a survey using the built-in feature of survey of Sharepoint.

After a respondent has completed the survey and pressed the ‘submit’ button, I want to pop up an acknowledgment message window showing message such as ‘Thank you for your participation.’ I am able to achieve this by using javascript to pop up the message when the ‘submit’ button is pressed.

However, in the survey there are a number of mandatory questions. If the respondent has not completed all the mandatory questions and press ‘submit’ button, the acknowledgment message still pops up. Could you please kindly advise how I can check whether all mandatory questions have been completed and survey response successfully submitted in order to determine in my javascript to pop up message or not accordingly?

I cannot check each question one by one because in case my users add one more question, I have to modify my javascript to check the additional question and this solution is not acceptable in my environment.

Thanks a lot for your advice.

0

You can achieve this by simply add a querystring "Source=" in your survey URL.

First, create a thank you page (e.g. /pages/thankyou.aspx). Then, in your survey newform URL (e.g. <site url>/Lists/survey/NewForm.aspx) add the querystring like this:

<site url>/Lists/survey/NewForm.aspx?Source=/Pages/thankyou.aspx

When the users completed the survey they will be redirected to /pages/thankyou.aspx which shows your message.

However, bear if mind that user click "cancel" in your survey will also be redirect to thankyou.aspx. I suggest you hide the button (I think cancel button is useless in survey anyway) or amend the cancel action with JavaScript.

  • but how could I check the questions? – heil Jul 13 '16 at 2:27
  • If you mark your question as "required field" you don't need to write your own validation. Also, you can add formula in your questions' "Validation settings" to validate in advanced. (e.g. sharepointdiary.com/2015/03/…) – Mark L Jul 13 '16 at 2:32
  • can i do it with js? like is there any indicator or identifier for the fields marked required and i can access them through a loop checking all the required fields are empty or not – heil Jul 13 '16 at 3:34
  • Sure. Of course. There is no conflict between my suggested approach and JS – Mark L Jul 13 '16 at 3:58
  • hmm how can i exactly add the query string to the existing asp? – heil Jul 14 '16 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.