dynamic form displays variable number of new text fields
I am thomas. This is my first post!
I have a question. I am trying to make a dynamic form. I have seen this addressed in a few other threads, but it is first of all not exactly like my problem and also, the language of the explanations is not simple enough for me to understand.
I am trying to make a form that has 1 box that asks how many designs a customer wishes to order, then based upon that number, reveals that many pairs of text boxes below; one should be with the label, «name of design», while the other should be with the label «quantity of design». That way, if a user enters 4, four pairs of these boxes will appear, asking him specific names and quantities
If I set up a variable quantity to the value of the text box, I think I should be able to loop like,
for x=1; x<=qty.value; x++
but then I am confused about how to make the thing render the text boxes. My primitive knowledge tells me I could do something like document.write. But on another thread I read I saw that I could also use
I cannot, however, really claim a comprehensive understanding of how this code works. Can you explain what this code does:
$field.name = 'Design[' + $i + ']';
$field.name = 'Design[' + $i + ']'; and $field.name = 'Quantity[' + $i + ']'; are assigning each field in the form a unique name, you will require this when retrieving the information on the server side.
If your using PHP, you would access the data as such