I am not very good with regular expressions, and for a school project I need to validate street address, city, zip and phone number fields in a form using JavaScript. I don't know where to start with regular expressions. I just need the basic validation: not empty (which I can do myself) and proper format.
Here is the base form fields.
Here is the base form fields.
HTML:
<table border="0" width="100%">
<tr>
<td>First Name</td>
<td><input type="text" name="fname" /></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="lname" /></td>
</tr>
<tr>
<td>Address</td>
<td><input type="text" name="address" /></td>
</tr>
<tr>
<td>City, state, ZIP</td>
<td><input type="text" style="width:200px;" name="city" /> <input type="text" style="width:50px;" name="state" /> <input type="text" style="width:75px;" name="ZIP" /></td>
</tr>
<tr>
<td>Phone</td>
<td><input type="text" name="phone" /></td>
</tr>
</table>
Last edited: