next up previous contents index
Next: A Calculator (Java-Script) Up: Java and Java Script Previous: Java and Java Script   Contents   Index

Validating forms (Java Script)

You may shift some load from the server and use Java Script e.g. to verify whether a user should leave a form.

<INPUT TYPE=SUBMIT VALUE="Good Bye" onclick="return 
   confirm('Do you really want to say good bye?')">

The onSubmit handler can also be used to validate user input. If in the following snippet the function validate returns false the form is not submitted.

<FORM onSubmit="return validate(this)">
...
</FORM>


next up previous contents index
Next: A Calculator (Java-Script) Up: Java and Java Script Previous: Java and Java Script   Contents   Index
Oliver Kirchkamp