Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: form example

  1. #1
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form example

    can someone show me a simple form example of a radio button form posting to another form and then to a third form, and the third form contains the value of the first and second - using seperate pages.

    Thank for helping me understand and learn!

    cheers

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This sort of multi-page form is best handled with a server-side language, and not javascript.

    Cookies, the query-string, or session variables need to be used to accomplish this. Javascript can handle cookies and the query-string, but this is not a super-simple setup.

    Also, doing this with javascript is incredibly insecure.

    Thoughts?
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts
    security is not an issue for me. Why is handling variables client side so difficult with JavaScript?

    could i use a .js file and inclue it with the pages, if so is there a JS script that acts like this VB script?:
    <%
    For Each thing In Request.Form
    Response.Write "<input type=""hidden"" name=""" & thing & """ value=""" & Request.Form(thing) & """>" & vbCrLf
    Next
    %>

    I can't use cookies or session variables, just the URL.

    please inform

    havey

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's not difficult -- it just has a few stigmas

    How many pieces of data are we talking about here? The query-string could quickly become too large if you string together too many forms in this fashion.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts
    these variables with their selected interger values, not exceeding into the triple digits, for example:
    form1:
    age=10
    form2:
    ada=34
    form3:
    edu=12
    form4:
    gua=5
    form5:
    lan=11
    form6:
    occ=16
    form7:
    reg=2
    form8:
    wor=6
    form 9 displays values from all preceeding forms

  • #6
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts
    like so:

    form1:

    <html>
    <head>
    <title>age</title>
    </head>
    <body>

    <form>
    <p>age10<input type="radio" value="10" checked name="age"></p>
    <p>age5<input type="radio" name="age" value="5"></p>
    <p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
    </form>

    </body>
    </html>

    form2:

    <html>
    <head>
    <title>ada</title>
    </head>
    <body>

    <form>
    <p>ada10<input type="radio" value="10" checked name="ada"></p>
    <p>ada5<input type="radio" name="ada" value="5"></p>
    <p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
    </form>

    </body>
    </html>

    form3:

    <html>
    <head>
    <title>edu</title>
    </head>
    <body>

    <form>
    <p>edu10<input type="radio" value="10" checked name="edu"></p>
    <p>edu5<input type="radio" name="edu" value="5"></p>
    <p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
    </form>

    </body>
    </html>

    form4:

    <html>
    <head>
    <title>gua</title>
    </head>
    <body>

    <form>
    <p>gua10<input type="radio" value="10" checked name="gua"></p>
    <p>gua5<input type="radio" name="gua" value="5"></p>
    <p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
    </form>

    </body>
    </html>

    form5:

    <html>
    <head>
    <title>lan</title>
    </head>
    <body>

    <form>
    <p>lan10<input type="radio" value="10" checked name="lan"></p>
    <p>lan5<input type="radio" name="lan" value="5"></p>
    <p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
    </form>

    </body>
    </html>

    form6:

    <html>
    <head>
    <title>occ</title>
    </head>
    <body>

    <form>
    <p>occ10<input type="radio" value="10" checked name="occ"></p>
    <p>occ5<input type="radio" name="occ" value="5"></p>
    <p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
    </form>

    </body>
    </html>

    form7:

    <html>
    <head>
    <title>reg</title>
    </head>
    <body>

    <form>
    <p>reg10<input type="radio" value="10" checked name="reg"></p>
    <p>reg5<input type="radio" name="reg" value="5"></p>
    <p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
    </form>

    </body>
    </html>

    form8:

    <html>
    <head>
    <title>wor</title>
    </head>
    <body>

    <form>
    <p>wor10<input type="radio" value="10" checked name="wor"></p>
    <p>wor5<input type="radio" name="wor" value="5"></p>
    <p><input type="submit" value="Submit"><input type="reset" value="Reset"></p>
    </form>

    </body>
    </html>

    form9:
    displayes values from forms 1 - 8
    Last edited by havey; 07-07-2003 at 06:45 PM.

  • #7
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This would be fairly easy to do using my Get class

    Basically, on every page except the first, you'd follow these steps

    1) Initialize GetVars object
    2) Loop through the form on the page and add values from the GetVars object

    That's pretty much it. I know this description is very brief, so let me know if you need something more to go on.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #8
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”


  •  

    Posting Permissions

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