AJAX for extra input fields
Posted on 2007-10-03
I have a form that asks users to fill in the quantity of an item they have sold. The form has about 20 products, each with a text input field to enter the quantity. I now find that I also need to capture each item's serial number.
I would like to design the form so that if the user enters 4 as the quanity purchased, four text input fields appear below the original, to accept the serial number information.
I need the AJAX to show the appropriate input fields for the serial numbers and to allow server side verification of the serial numbers as they are entered.
My current input variables are arrays: e.g. <input type='text' name='prod[PC900]' value='' size='6'>
I would prefer the serial number be a compound array. e.g. prod_serial[PC900], prod_serial[PC900].
I am already using some AJAX on the page using Rafael Dohms brilliant autocomplete script for the company field, and I have used some other AJAX code on my site (although not on this page), but they have been modifiations of published scripts. I am not a Java/AJAX guru myself.
I am using PHP for the server side.
I really appreciate your help.