add like jQuery Dynamic form with ajax verification

mad_doc

New Member
I'm trying to create a multi-field dynamic form with jQuery. I was looking to do something along the lines of this: http://jsfiddle.net/5ZRu2/3/Currently, the "Add new" button adds a new blank form. What I am trying to do is have the "Add like" button copy the associated form data and append a new form with this data filled in. I'm not too familiar with jQuery, so any suggestions would be great.My second question is about validating the dynamic form with ajax. I am currently only able to validate the input fields of a single form (same fields in jsfiddle example) with ajax. The code breaks with dynamic forms, and I'm not exactly sure why. As of now for the single form, I'm checking to see if an invoice number is already in the database for a specified vendor like this:\[code\]<INPUT TYPE='text' onchange='return sendRequestInvNbr(this.form.i_invce_nbr.value, this.form.i_vendor.value)' NAME='i_invce_nbr'>\[/code\]The sendRequestInvNBR function:\[code\]function sendRequestInvNbr(invnbr, vndr) {var url = 'ajax.php?checkinv-nbr=' + encodeURIComponent(invnbr) + '&vndr=' + encodeURIComponent(vndr) +'&random=' + Math.random();http.open('get', url);http.onreadystatechange = handleResponse2;http.send(null);}\[/code\]ajax.php queries the database to see if the invoice number exists for the specified vendor, and sends back an appropriate error code letting the user know the invoice exists before they submit the form.How would I go about checking each of the cloned forms to see if the input is valid? Am I on the right track, or is there another way of doing this that someone can recommend?
 
Top