Skip questions
based on user input

Chong-ho (Alex) Yu, Ph.D., MCSE, CNE

Problem:

In an online survey participants are not required to answer all questions. For example, if a user answers "No" in Question 9, he will skip Question 10 through 19. If the user answers "Yes," he will continue the survey from Question 10. How could I set up the skipping?

Solution:

First, Question 9, in which the decision is made, Question 10-19, and Question 20-n must be in separate pages. The last one (Question 20-n) must have two versions. In the page carrying Question 9, insert the following code


	<INPUT TYPE="hidden" NAME="-format" VALUE="error.htm">
	Have you ever gone on a Spring-Break vacation in the past? <BR>
	<INPUT TYPE=radio NAME="-format" VALUE="new3.htm">No
	(If no, the system will take you directly to Question 20)<BR>
	<INPUT TYPE=radio NAME="-format" VALUE="new2.htm">Yes

The hidden input field accepts a value to determine which page should be shown next. If no input is submitted, an error page will be shown. You can customize the error message as "You must fill in the required field." However, the radio input field does not capture the value "Yes" or "No." In order to enter the answer of Question 9 to the database, the page carrying Question 10 through 19 must have the following code:


	<INPUT TYPE=hidden NAME=Q9 VALUE=Yes>

As mentioned before, the page carrying Question 20-n should have two versions. One version is for those users who answer "No" in Question 9. In this version, the following code should be added. Another version is for those users who answer "Yes." In this version no additional code is needed. The page sequence should be properly ordered so that the correct answers are captured.

 


	<INPUT TYPE=hidden NAME=Q9 VALUE=No>

Navigation

FMP Tips Contents

Other computer tips

Search Engine

Credit/Copyright ©

Simplified Navigation

Table of Contents

Contact Me