I've already created a simple method of ensuring that all form feilds
are filled out before the form is submitted to an ASP page for records
to be added to the data base.
(Sorry about the formating, my newsreader may make it a mess!)
<script language="javascript">
<!--
function Check(form)
{
if (form.PersonID.value == "" || form.PersonID.value.length != 8)
{
alert("Please include an ID that is 8 characters");
form.PersonID.focus();
return false;
}
//There are more checking feilds here as well for phone number etc...
{
return true;
}
}
//-->
</script>
At the moment, that code above just makes sure that the user has entered
at least 8 characters/numbers.
Now what I want to do is make sure that in the PersonID feild that the
user enters only an id that begins with the letter "p" (lowercase only)
followed only by any 7 numbers.
ie. p1234567, p7654321, p2468135 etc...
How do I do this?
Cheers.