Welcome to my ASP Code Website

Auto Fill In Web Field Forms



Let's say you have a big contract page where you want a person's name to fill into many spots automatically when they type it in once. How do you do that?

First, put a form on the entire page, starting at the top and ending at the bottom. That way you can make calls to anywhere on the page to perform actions.

Next, create an input box where the user can type in their name. You can use:

Full Name:
<input type="text" name="username" size="50" MAXLENGTH="50" onChange="UserName(this.form,this.form.username.value)">

Next, the script called UserName. This is the script that is called any time a change is done to the above field. Put this right above where the form begins.

<SCRIPT LANGUAGE="JavaScript">
<!--
function UserName(form, username) {
form.userplace.value = username
}
// -->
</SCRIPT>

Finally, everywhere in the form where you want the form to fill in the name, use this:



You can do this for multiple fields - just make sure you change the name of the function and the fields in each case.

ASP Form Creation and Security