View Full Version : 'Add Another' Option Within Form

06-06-2006, 06:04 PM
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?:confused:

Thanks in advance....

06-09-2006, 01:25 AM
Maybe document.write('Your form here')?

06-09-2006, 01:38 AM
Not sure about javascript, but remember that you'd need to make them:

function addnamefield() {
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...