Jump to content

help with forms


lional

Recommended Posts

Hi All
I am trying to create a form that has five fields, when all the fields have been filled in and either tab or enter is hit, a new line must appear with the same 5 fields..
I would like the name and id of each input to be dynamically assigned.
I am very new to javascript so i have no idea where to start.
Could somebody please point me in the right direction

here is my code so far:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Returns</title>
</head>
<body>
<table summary="">
<tr>
<td>Name</td>
<td>Address</td>
<td>Tel</td>
<td>Fax</td>
<td>Email Address</td>
</tr>
<tr>
<td><input id="name" name="name" type="text" value=""></td>
<td><input id="address" name="address" type="text"value=""></td>
<td><input id="tel" name="tel" type="text"value=""></td>
<td><input id="fax" name="fax" type="text"value=""></td>
<td><input id="mail" name="mail" type="text"value=""></td>
</tr>
<td><input type="submit" name="submit" value="Submit"
</table>

</body>
</html>

Thanks

Lional
Link to comment
https://forums.phpfreaks.com/topic/25898-help-with-forms/
Share on other sites

Well, you'll have to handle a few things:

1) an onblur handler for each field that checks to see whether the other named fields are completed or not;
2) A list of all the fields to be checked;
3) A way of uniquely addressing each set;
4) Some JS DOM methods to write out a new row.
5) A key handler to capture tab/enter characters so that the form doesn't get submitted.
Link to comment
https://forums.phpfreaks.com/topic/25898-help-with-forms/#findComment-118605
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.