rafaelrgl
asked on
Prevent user from typing phone number on textbox with multiline
how can i prevent user from typing phone number or any word that repeats the characters like this: aaaa, ..........., bbbbbbbbb.
sometimes the user types like that because i put an rule that force the user to type more then 500 characters.
help on this.
sometimes the user types like that because i put an rule that force the user to type more then 500 characters.
help on this.
ASKER
it did not worked as expected:
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ControlToValidate="txtdescription" Display="None"
ErrorMessage="<b> Error- Repeted characters too much."
ValidationGroup="uservalidation" ValidationExpression="^(?=.{4,31}$)(?![-.])(?:(?!(.)\1{4})[-.\w])+(?<![-.])$"></asp:RegularExpressionValidator>
<asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1"
runat="server" CssClass="CustomValidatorCalloutStyle" Enabled="True"
HighlightCssClass="highlight" PopupPosition="BottomRight"
TargetControlID="RegularExpressionValidator2" Width="300px">
</asp:ValidatorCalloutExtender>
What happened?
ASKER
it worked, sorry, it was my mistake. what about phonenumbers, can i check for that too, and also can i check for url's so i can block those too.
ASKER
well, i test again, and it's really not working:
enter:
i love this car a lots, i just want to drive
it's not valid this input above, why? i should pass.
enter:
i love this car a lots, i just want to drive
it's not valid this input above, why? i should pass.
sorry i don't understand... what is wrong with "i love this car a lots, i just want to drive"... you said "i should pass". Â sorry this makes no sense to me
ASKER
i mean, it's saying there is repetitive characters on this sentence. So it should pass the regular expression ^(?=.{4,31}$)(?![-.])(?:(? !(.)\1{4}) [-.\w])+(? <![-.])$
but it's blocking this sentence.
but it's blocking this sentence.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
^(?=.{4,31}$)(?![-.])(?:(?