[UFO Chicago] html forms and javascript

Lukas Eklund leklund@tastytronic.net
Mon, 30 Sep 2002 14:29:03 -0400


Quoting Robert B. Moses:
> <form method="post" action="doit.php">
> 	Name :
> 	<input type="text" name="name1"/>
> 	<input type="button" name="submit1" value="Submit"
> 		onClick="validate();"/>
> 	<input type="reset" name="cancel1" value="Cancel" />
> </form>

I would recommend using the onSubmit method inside the form tag.

<form method="post" action="doit.php" onSubmit="return validate();">

Then in the validation script you can just return false if it fails.

-- 
Lukas Eklund
leklund@tastytronic.net