[theforum] Reg Expressions to validate form
Sue S
sue19 at ymail.com
Thu Nov 6 20:24:49 CST 2008
Hi There,
I am learning Java script and was wondering somebody could give me the code to validate a simple form using Reg Expressions please?
1-It should not validate if there is a number in the Name and last name fields
2-Phone pattern should be xxx-xxx-xxxx
3-should check for the @ sign, dot sign and com in email field.
4-should warn the user to enter the correct pattern next to each field
here it is the html code:
<form method="get" action="Thank you.html">
<fieldset>
<label for="FirstName">First Name</label>
<input type="text" id="FirstName" value="" />
</fieldset>
<p id="firstNameError">
</p>
<hr />
<fieldset>
<label for="LastName">Last Name</label>
<input type="text" id="LastName" value="" />
</fieldset>
<p id="LastNameError">
</p>
<hr />
<fieldset>
<label for="Email">Email</label>
<input type="text" id="Email" value="" />
</fieldset>
<p id="EmailError">
</p>
<hr />
<fieldset>
<label for="Phone">Phone</label>
<input type="text" id="Phone" value="" />
</fieldset>
<p id="EmailError">
</p>
<hr />
<fieldset>
<input type="submit" id="submitButton" value="Submit" />
</fieldset>
<hr />
</form>
</div>
</body>
Thanks in advance.
__________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
More information about the theforum
mailing list