I'd like to be able to validate whether these two fields are completed and also if they are in a certain format. I already have the validation below to check to see if the fields are empty. I'd like to add the validation the existing code that will make sure that the Zip Code format is either XXXXX-XXXX or XXXXX and that the Phone number format is XXX-XXX-XXXX. There are other fields in the form & other validation code, this is just what I need to change.
<form method="post" action="process.asp" onsubmit="return Blank_TextField_Validator(this)">
Zip Code: <input size=25 maxlength=10 name="zip">
Phone Number:<input type="text" name="telno" size=25>
if (form.zip.value == "")
alert("Please fill in the Zip code field using the format XXXXX-XXXX or XXXXX.");
if (form.telno.value == "")
alert("Please fill in the Phone Number field using the format XXX-XXX-XXXX.");