As of now, I am validating my fields to just check that the field was filled in. Now I want to validate the entries further. For name- only alpha characters, zip-only numerical characters, ect. I know I'm going to have to use regular expressions, but as I'm new to regular expressions, I don't know how to insert it into my existing validation, any help would be appreciated.
Snippets of my current code:
<script type="text/javascript">
<!--
function validate_form()
{
valid = true;
if (document.form.name.value == '')
{
alert ( "please enter your name." );
valid = false;
}
return valid;
}
//-->
</script>
<!-- Text widgets for the customers name and address -->
<tr>
<td> Buyers Name: </td>
<td> <input type = "text" name = "name"
size = "30" onblur="validate_form()"
/></td>
Again, any help would be awesome
Reply With Quote
Snippets of my current code:
<script type="text/javascript">
<!--
function validate_form()
{
valid = true;
if (document.form.name.value == '')
{
alert ( "please enter your name." );
valid = false;
}
return valid;
}
//-->
</script>
<!-- Text widgets for the customers name and address -->
<tr>
<td> Buyers Name: </td>
<td> <input type = "text" name = "name"
size = "30" onblur="validate_form()"
/></td>
Again, any help would be awesome
Reply With Quote