Adding More Controls To RegularExpressionValidator?
Nov 25, 2010
Is there a way to add more than one ControlToValidate to my RegularExpressionValidator?I have two textboxes for postcode and I want to add the same RegularExpressionValidator to both.Currently I have one for each box but if they are both wrong it shows up two error messages but I only want the user to see one.Here's my RegularExpressionValidator
<asp:RegularExpressionValidator CssClass="errorpopup" Display="Dynamic" ID="rvpPostCodeZone" validationgroup="tbEditEmailCorr" runat="server" ErrorMessage="<strong>Please enter a valid post code.</strong>" ControlToValidate="tbEditPostCodeZone" ValidationExpression="^[0-9a-zA-Z' ']{3,}$" SetFocusOnError="true" />
I'm trying to add an exception to my RegularExpressionValidatorBasically i'm populating a textbox with the text "Not supplied" if the user hasn't given us the information if they try and submit that field I have a RegularExpressionValidator which only allows 0-9 characters so it shows the error message. Is there a way to add the exception "Not supplied" to my RegularExpressionValidator?Here's the code.
I have a text field where user can enter either an URL or an Email address. How can I use a RegularExpressionValidator to validate that user have entered an URL or an Email address
I had a question on here for a RegularExpressionValidator which I'm relatively new to. It was to accept all alphanumeric, apostrophe, hyphen, underscore, space, ampersand, comma, parentheses, full stop. The answer I was given was:
"^([a-zA-Z0-9 '-_&,().])+$"
This seemed good at first but it seems to accept amoung other things '*'.
below is the code and when i select a wrong filetype i get instant red "*" but i dont see the validation summary and there is a buton("upload") and when i click on it than i get the validation summary error message.
my question is: why validation summary is not displaying when i select the wrong file type?
Is there any way to make a RegularExpressionValidator render itself using display:block, instead of display:inline in its style attribute, when setting the Display property to "Display='Dynamic'"?
I have tried setting it in the stylesheet but this gets overwritten when it is rendered on the page.
I have a query on RegularExpressionValidator. Although this question already asked in various time, I just want to confirm that if I want to validate "only alphanumeric or(and) double quote, single quote, exclamation, semicolon, colon, ampersand, dot, comma, hyphen, question mark, front slash, parentheses, space of 5-40 character length" then will the regular expression be this :
I would like to raise error by myself and use reqularexpressionvalidator to show it's text. (My idea is to reuse this control.) I don't remember what property should I use, and what to assign to show the message from control. How to raise error for this control from code?
I have a ValidationExpression that works fine in IE8 and Firefox but client uses IE6 and it doesn't seem to work for them. The issue concerns special characters in a password text box, the clients wants to be able to INCLUDE special characters but IE6 doesn't seem to pick them.
Basically we want to be able to include any letter (upper and lower case) , any number and any special character. This is what I've got so far...
I have a textbox with a RegularExpressionValidator. I want to require the user to enter at least n characters. I'd also like to remove whitespace both at the start and end of the textbox. I'd still like to allow spaces within the textbox, I just want to remove the excess at the beginning and end. I basically don't know how to combine the trim regex and the count together for use in a REV.
trim: ^s*((?:[Ss]*S)?)s*$ count: .{10}.*
I basically want to know if the input, after leading and trailing whitespace is removed, is greater than n characters.
Wondering if you could give me a nudge in the right direction. I'm working on an app where I need to validate a field for a correct URL. However, this is an optional field and may be left blankI was just wondering, how can I bypass the validator if the field is null.
i am working with web services webmethod and i have a method that accepts a string of phonumber (1234567890) and how can i make sure before i make a call to API that, the phone number is valid (no characters or not less then 10 digits)
Does the RegularExpressionValidator always need a RequiredFieldValidator?I see that when there is no input the RegularExpressionValidator is not working. Correct?
so what did i do wrong with the regex that its now allowing other document types to be uploaded. I need to make sure that ONLY pdf are allowed. What can i change to the validator and if anything add to the code behind to correct this?
My implementation is simple. I have a public static variable in a class called EmailHelper containing my regular expression as follows:
[Code]....
I then have the following web controls on my page:
[Code]....
The problem is that doesn't matter what regular expression I define as the value of my static public variable bound to the <asp:RegularExpressionValidator />, I always get an error (i.e. it aways says "invalid email")...
This regular expression (stored in an ASP.NET regular expression validator) works fine in IE8 and firefox but fails in IE7: (?=.[0-9])(?=.[a-z]).{7,30}
gularExpressionValidator on my textbox that I am already using, but I need it tweaked. Here is the one I'm using: ^(([0-9]|[1][0-9]|2[0-3])(.)(25|50|75|00))|(24.00)|([0-9]|[1][0-9]|[2][0-4])$It is for the input of hours worked in a day. The minimum is 0.00 and the max is 24.00. The hours are rounded off to the quarter hour, so it allows for .25, .50, .75, and .00.
I have Asp:TextBox,Asp:RegularExpressionValidator and Asp:RangeValidator on .aspx page.
These two validators have ControlToValidate value equal to textBox Id.
RegularExpressionValidator have validation Expression such that it allows only number.
Range validator have maximum value ="100" and if I enter any text then both validators get fired .
Logically only RegularExpressionValidator should fire if I enter any textvalue.
Is there any property of Range validator such that it check for numeric value to compare and disbled if value entered in textBox is some text so that no handling of event(Client side and Server side both) is required.