Results 1 to 3 of 3

Thread: 'Add Another' Option Within Form

  1. #1
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question 'Add Another' Option Within Form

    Within a Form, I'm giving the user the option to enter (say) 3 names - so I then have 3 values. What I'd like to do is give the user the option to "Add another?" ... up to, say, a maximum of 7 individual inputs.

    What I need to do is somehow create a new variable for each 'addition' and display a new input box each time 'add another' is selected - rolling down the page until the user is through or has reached the maximum number.

    In an attempt to keep the form tidy, on-screen, and in not knowing how many the user in any particular scenario may choose to keep adding.... can someone please suggest how I might achieve this?

    Thanks in advance....

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Maybe document.write('Your form here')?
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Not sure about javascript, but remember that you'd need to make them:
    name1
    name2
    name3

    then...
    function addnamefield() {
    numextranames++;
    namenumber = 3 + numextranames;
    doc.write('<input name="name'+namenumber+'">');
    }

    That's not right, but my point is that you need to increase it like "name1, name2, name3....... name10, nameX...."
    Then, when interpreting, just keep checking for the next one til it doesn't exist...
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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