In my application users can make their own web forms for sign ups. Each newly added field has three elements: field_name, field_type and field_rules. I need at least the field_name to be specified.
My problem is when the validation fails, I lose the newly added form fields when the page reloads. How can I send back form errors to each respected form field and still keep all their work when the form validation fails?
EDIT: Sorry if I wasn’t clear. Okay, so jQuery is used to add form fields to a page. Each cloned div contains three text boxes: field_name, field_type and field_rules. What I want to do is use CodeIgniter to iterate over those arrays to check if the required fields I need have content. If not, I want to send the user back to the form page with all of the user-added jQuery cloned divs there with the user-defined data present.
I’ve been working on a conditional construct that will check the $data array to determine if it should iterate the divs out. What I’m wondering is if there is an easier way: ie: send the data to jQuery on next page load or something.
Check this out: http://www.jqbyte.com/StickyForms/
It’s a nice trick which you could use — storing newly added fields and values in cookies.