I'm creating a course registration form that requires user entering any desired number of candidates that will be taking the course from his or her company.
Example: If a user enters 3 into the field named "No of Candidates", the script should generate 3 rows with fields like "Name", "Email", "Phone", "Sex" and "Position" for each candidate's information.
Pls Find below the html for the "No of Candidate" field and Fields to be generated for user to enter each Candidate's information.
Pls Note: Fields to be generated is based on user's input. i.e it can be 3, 5, 10 e.t.c
<p>
<label><strong>No of Candidates</strong></label>
<label><input name="cand_no" type="text" placeholder="Type Your Number of Candidates" onchange='this.form.submit()' /></label>
<div class="clear"></div>
</p>
<div class="cand_fields">
<table width="630" border="0">
<tr>
<td>Name</td>
<td width="20">Sex</td>
<td>Email</td>
<td>Phone</td>
<td width="40">Position</td>
</tr>
<tr>
<td><input name="cand_name" type="text" placeholder="Name" required="required" /></td>
<td>
<select name="cand_sex" required="required">
<option value=" "> </option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</td>
<td><input name="cand_email" type="text" placeholder="Email" required="required" /></td>
<td><input name="cand_phone" type="text" placeholder="Phone" required="required" /></td>
<td><input name="cand_pos" type="text" placeholder="Position" required="required" /></td>
</tr>
</table></div>
I've tried this with php but it isn't pleasant doing this from the server side. So, I really need it to be done from the client side using javascript.
I'll be very grateful if this can be achieved with javascript...
Thanks a million!