sharon5467 Posted November 3, 2005 Share Posted November 3, 2005 Hi I am trying to use create a validation form where I have a text box that the user has to enter two letters before digits, how can this be accomplished?Please help!!!Many Thanks Link to comment Share on other sites More sharing options...
hacknsack Posted November 4, 2005 Share Posted November 4, 2005 Here's an example for you, uses a regular expression: Title>Text box with capitals before numbers?Post>text box that the user has to enter two letters before digits <html><head><title>sharon5467 Field Checker</title><script type="text/javascript">function ckForm(form){var re = /^[A-Z]{2}\d+$/; if(!re.test(form.elements['t1'].value)){ alert('Try Correct Format..'); return false; }return true;}</script> </head><body><form onsubmit="return ckForm(this)"><input type="text" name="t1" size="10"><p><input type="submit"></p></form></body></html> Some links for you:http://www.w3schools.com/js/js_form_validation.asphttp://www.siteexperts.com/tips/functions/ts23/page3.aspDevMoPost back if you need any help.Thanks, Link to comment Share on other sites More sharing options...
sharon5467 Posted November 4, 2005 Author Share Posted November 4, 2005 Many thanks for that, its a great help.Sharon Link to comment Share on other sites More sharing options...
hacknsack Posted November 4, 2005 Share Posted November 4, 2005 Glad it was helpful.Post back if you have more questions. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now