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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.