Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate text befroe submit? 4

Status
Not open for further replies.

markdmac

MIS
Dec 20, 2003
12,340
US
Hi everyone,

I have created a web page to grab an employeeID number. The employee numbers can have one of two formats:

1. 7 characters and start with an Alpha for permanent employees.
2. 6 characters and be numeric if a contractor

I'd like to know if there is a way in classic ASP to validate that the input meets either of these two patterns before submitting information to the page that will take action on it. It was suggested in the ASP forum that javascript is the only way to do it. I'm a VBScript guy and lost with JavaScript.

Can anyone offer any suggestions?

Currently my input box looks like this:

<INPUT TYPE="text" NAME="EmpID" VALUE='' size="20" color="white"></INPUT>

Any help is greatly appreciated.
 
Thanks Kaht,

What is happening is that the function appears to no longer be checking anything.

Without adding the sections for the phone numbers, if I submit the form with an invalid employee ID I get a warning. If I add int he phone checking parts, the same code for the employee ID no longer seems to validate. An incorrect Employee ID is ignored. An invalid phone number is also ignored.

I'm not sure how to add any error checking.

I'll cut down my validation string and see if it has any bearing on the results. Thank you for helping me to streamline the code some.

Any other suggestions to help isolate why the above function is not working?
 
I found the mistake. Really dumb mistake on my part. I had a bad variable name. I copied each number in one at a time and tested after each. Of course when I got to the last one I found my problem. [blush]

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
If you're not using it, the web developer toolbar for firefox is really handy about debugging web stuff. Every time you hit a javascript error a little red warning icon lights up. Not to mention, the javascript error descriptions in firefox are light years ahead of internet explorer's

-kaht

Looking for a puppy? [small](Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top