Here is a sample form. Enter data and notice the input validation on each field.
NO JAVASCRIPT PROGRAMMING REQUIRED!
The types of checks performed are:
Directions:
You may also have immediate field validation by adding:
You may have multiple options separated by a semicolon (ie. editcheck="cvt=TU;type=alpha"). Each option has this format: The error message is optional.
Here are the options for attribute editcheck:
<script type="text/javascript" src="editcheck.js"></script>
onsubmit="return valforms(this)"
This will provide form validation when the Submit button is pressed for the form.
onchange="return valforms(this.form,this)"
to your <INPUT> tags.
Example.
Name: <input name=fullname type=text size=20 maxlength=20 editcheck="req=Y=Please enter your name.;cvt=UT">
Birth Date: <input name=birthdt type=text size=10 maxlength=10 editcheck="req=Y=Please enter your birthdate.;type=date">
Zip Code: <input name=zip type=text size=11 maxlength=10
editcheck="req=Y=Zip Code is required.;type=zip=Please enter a valid US zip code.;cvt=~">
NAME=VALUE=ERROR MESSAGE
Name/Value | Description |
---|---|
req=Y | Required field - a value must be entered. |
type=datatype | Datatype is one of these:
|
minval=999 | For numeric fields, the minimum allowed value. |
maxval=999 | For numeric fields, the maximum allowed value. |
minlen=999 | The minimum # of characters in field if entered. |
maxlen=999 | The maximum # of characters in field if entered. |
eval=javascript validation string | Validation via javascript expression - a valid javascript expression must be entered. If the expression is false, the error message displays. See the source code for "Last Date Attended" above to see an example of preventing future dates |
cvt=cmdstring | Convert function- cmdstring is any combination of the following letters:
|