Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
The problem is when I am adding more than one validation rule for username,at the time of running the error message showing is only of the first rule. i want the error message to be displayed corresponding to the rule

my first validation rule is

1."^[a-zA-Z]+[a-zA-Z0-9]*$" and the corresponding error message is "Invalid Username[Hint:should start with letters,include numbers also]"

second rule is

2."^([A-Z]+)$" and the corresponding error message is "Invalid Username[block letters not allowed]"

Third rule is

3."^[.!@#$%^&*()_+-=]+$" and the corresponding error message is

"Invalid Username[special symbols not allowed]"

when I am entering a special symbol the error message showing is "Invalid Username[Hint:should start with letters,include numbers also]" which is the first error message I want third error message to be shown in that place.
Posted
Updated 15-Dec-15 23:18pm
v2
Comments
phil.o 16-Dec-15 4:03am    
Please press the "Improve question" button at the bottom of your question, and qualify it with your current validation code.
Leo Chapiro 16-Dec-15 4:25am    
Marked as "Unclear/Incomplete"
CHill60 16-Dec-15 5:36am    
You've added the validation rules but not the code that you are using to validate nor display the error message
Member 12207862 16-Dec-15 6:00am    
I am using Oracle JDeveloper12c I am writing the regular expression in business rules
CHill60 16-Dec-15 6:02am    
Then perhaps you ought to tag your question with Oracle and put this rather relevant information into your post

1 solution

Why having several validation rules? Are you the guy who takes pleasure when people have to try a new password several times, with the rules given to them piece by piece?

You have a design issue imho, you should have a single validation rule when you use regular expressions.

Moreover, I've read you regular expressions several times, and something quite disturbs me: the first one seems to be an inclusive one, I mean you seem to describe what is accepted as input. So far, so good. But then, for number two and three, you define in your expressions what is not accepted.
There is something wrong going on. I don't do Oracle, so I'm not going further on this, but I think it's a good idea to start by analyzing and fixing this contradiction.

In your further questions here on CodeProject, please take care to always tag your question precisely.

Hope this helps. Good work :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900