Pre-Fill Forms From Last Use
By Will Bontrager2005-04-18
The JavaScript Below the Form
Three lines of JavaScript need to be put below the form. It doesn't matter where below the form, so long as it's after the tag.
This Java causes the form fields to be pre-filled in, which is the reason the code needs to be below the form. If the code were above the form, the browser might try to execute the JavaScript before the form is loaded.
Here is an example of the three lines of JavaScript:
<script type="text/javascript" language="JavaScript"><!--Replace formname with the name you gave the form.
PopulateFormFields('formname','_____');
//--></script>
Replace _____ with a list of this form's fields that you want the browser to pre-fill. The form field names are separated with a comma, like
fieldname1,fieldname2,fieldname3Note: The information between the parenthesis should be exactly the same as the information between the parenthesis of the "onSubmit" attribute in the ACTION tag.
The demonstration page has examples.
Tutorial Pages:
» Pre-Fill Forms From Last Use
» Why?
» The Source Code
» The JavaScript code of the HEAD Area
» The Form's ACTION Tag
» The JavaScript Below the Form
» A Limitation
» Conclusion
Copyright 2004 Bontrager Connection, LLC
