Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2002
    Thanked 0 Times in 0 Posts

    multiple forms - select next on

    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?

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Between DC and Baltimore In a Cave
    Thanked 94 Times in 88 Posts
    Use javascript to change the action of the form to where you submit it.

    document.formname.action = "blah"

    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Thanked 256 Times in 252 Posts
    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" />

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts