When I click on an "Add" button, it would create a new form with the "First Name", "Last Name" field and 2 textboxes, just like the original.
So if I click on the "Add" button 5 times, it would create 5 new forms for me. Same idea applies for the "Delete" button.
Here's my code:
<meta charset=utf-8 />
<FORM NAME="myForm" id="facebookAcc" onsubmit="return false">
First Name: <input type="text" name="1stName" ><br />
Last Name: <input type="text" name="lastName" ><br /><br />
<input id="bu_add" type="button" value="Add" >
<input id="bu_delete" type="button" value="Delete">
If you can help me out, I would greatly appreciated. Or if you know what this is call, I can just look it up.
- Are you wanting to create the new form fields a from ones already existing in the form (via templating) or are you wanting to use scripting to create the fields separately?
- How are the new fields going to be named so that the server can tell the difference between them? Are they going to be numbered sequentially, or used as an array.
- Are the add and delete buttons going to be at the bottom of the form? If so, what is the delete button going to delete?
- If you have a separate delete button on each field, what happens when you delete a row in the middle? If the fields are sequentially numbered will there be a missing gap, or will you renumber the names of the different fields?
- When you add a field, does it look at each potential row number for a suitable gap in the sequence, or does it just add one to the row at the end?
I suggest that you template from an existing row using paragraphs to separate each row, and use an array notation on the field names if you intend for PHP to be the server-side solution for receiving your form submission.
This topic is now closed. New replies are no longer allowed.