Link to home
Start Free TrialLog in
Avatar of arendt73
arendt73

asked on

Javascript validation submission page with special field

I need to validate a text field (case_number) in an ASP submission form that contains the following format:

#:##-bk-#####

example: 5:12-bk-12345
or             3:11-bk-99345

Is there anyway that Javascript can validate this specific format? The amount of characters will always be no less than 13, and the : - bk - will always remain a constant.

Any help is greatly appreciated. I attempted the following but it does not work.

Thank you!

if (/^[0-9a-zA-z:-]{13}$/.test(theForm.case_number.value)===false)
{
alert("Case Number format is not correct");
theForm.case_number.focus();
return (false);
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of nap0leon
nap0leon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arendt73
arendt73

ASKER

Solution given acceptable.