![]() |
JavaScript Form Validator
|
||||||||||||||
|
Home > Toys > Here It performs several checks on the data in the form below. If the specified input fields have no data, the JavaScript program will ask for confirmation prior to submitting the data to your web server. Used in this way, part of the form validation for large, multi-field, or complicated host application screens can be performed on the browser end. In this example form, if the 'Full Name Field' and the 'Fully Qualified Address' must have something in them before the 'Submit' button is clicked. If this is not the case, a JavaScript 'confirm()' box will be displayed along with a message about which input fields need to be addressed. Given the artificial nature of the input tag names chosen, a mapping of 'x12y2' to a name 'Full Name Field' is accomplished in the JavaScript. This is an unfortunate pre-processing cost of this JavaScript program. All fields of each form that you care to use this JavaScript program on will have to be cataloged, mapped (weird name to field name) and either a separate modified copy of this JavaScript program will have to be created, or a more ambitious use of a server-side include would have to be attempted.
|
||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
||||||||||||||