Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with validation

Status
Not open for further replies.

itsnickj

Technical User
May 2, 2008
2
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top