View Full Version : multiple forms - select next on

12-11-2003, 10:44 PM
I have a series of forms that I need to present to my site visitors, and what I want to do is determine which sequence of form the visitor sees based on the input in the first form.

An example to better describe this is that my first form contains (amongst other information) 3 checkboxes of which my users will select one. I want the next form that they see to be dependent on which of the 3 checkboxes have been 'ticked'...so if the first checkbox is ticked the user will get presented with form2, if the 2nd checkbox is ticked they will get taken to form3, and if they tick the 3rd checkbox they will get taken to form4.

The other information that is on form1 (other than the checkboxes) is passed forward onto form2, form3, form4 as hidden field inputs. When form2, form3 or form4 is completed it will then be submitted via email ....I can handle passing information through the series of forms and emailing the end product, but can't see how to drive which forms my users will be presented with.

How can I build this into the <form> </form> section of my page?

12-12-2003, 02:44 AM
Use javascript to change the action of the form to where you submit it.

document.formname.action = "blah"


12-12-2003, 07:11 AM
and you should use radio buttons instead of checkboxes since you only want users to select one.

<input type="radio" name="rad" value="1" onclick="this.form.action='page2.asp'" />Option 1
<input type="radio" name="rad" value="2" onclick="this.form.action='page3.asp'" />Option 2
<input type="radio" name="rad" value="3" onclick="this.form.action='page4.asp'" />Option 3
<input type="Submit" value="Next" />