yandoo Posted April 15, 2008 Share Posted April 15, 2008 Hi there, I have a simple form and vallidation that is ONLY setup to work on one textfield "field2". Im trying to add the vallidation to the other textfields in the form..... Please help, How can i do this????? Heres the JS between the <HEAD's>: <script type="text/javascript"> function validate(form){ if(!form.field2.value.length){ alert('Please enter a value'); form.field2.focus(); return false; } return true; } </script> And heres the form with the valiidation Added to ONLY "field2": <form method="post" name="form1" action="<?php echo $editFormAction; ?>" onsubmit="return validate(this);"> ID: <input type="text" name="ID" value="" size="32"> Field1: <input type="text" name="field1" value="" size="32"> Field2 <input type="text" name="field2" value="" size="32"> <input type="submit" value="Insert record"> <input type="hidden" name="MM_insert" value="form1"> </form> Kind Regards Quote Link to comment Share on other sites More sharing options...
zenag Posted April 16, 2008 Share Posted April 16, 2008 use same script just change names instead of field2... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.