473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

RegularExpressionValidator allowing no entry

I have a RegularExpressionValidator that doesn't seem to work correctly if
you don't enter anything. In the following, it works correctly if you have
at least 1 character. If you just enter through the field it lets you (even
thoug no entry would be less that 6 characters.

<asp:textbox id="password1" TextMode="Password" Columns="45"
runat="server" /><asp:label text=" 6-20 characters with at least 1 numeric"
style="color:red" runat="server"/>
<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain between 6 and 20 characters!"
ValidationExpression="\w{6,20}"
Runat="Server" />

<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain at least one number and
letter!"
ValidationExpression="[a-zA-Z]+\w*\d+\w*"
Runat="Server" />

I can solve the problem by also putting a RequiredFieldValidator, it's just
that that requires another object that shouldn't be needed (at least, I
wouldn't think so).

Tom
Nov 19 '05 #1
3 3654
Tshad:
That's how the regular expression validator works...so you need that extra
field...though I agree with you it shouldn't be like that....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have a RegularExpressionValidator that doesn't seem to work correctly if
you don't enter anything. In the following, it works correctly if you have at least 1 character. If you just enter through the field it lets you (even thoug no entry would be less that 6 characters.

<asp:textbox id="password1" TextMode="Password" Columns="45"
runat="server" /><asp:label text=" 6-20 characters with at least 1 numeric" style="color:red" runat="server"/>
<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain between 6 and 20 characters!" ValidationExpression="\w{6,20}"
Runat="Server" />

<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain at least one number and
letter!"
ValidationExpression="[a-zA-Z]+\w*\d+\w*"
Runat="Server" />

I can solve the problem by also putting a RequiredFieldValidator, it's just that that requires another object that shouldn't be needed (at least, I
wouldn't think so).

Tom

Nov 19 '05 #2
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Tshad:
That's how the regular expression validator works...so you need that extra
field...though I agree with you it shouldn't be like that....
I figured that was the case.

Bummer.

Thanks,

Tom
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have a RegularExpressionValidator that doesn't seem to work correctly
if
you don't enter anything. In the following, it works correctly if you

have
at least 1 character. If you just enter through the field it lets you

(even
thoug no entry would be less that 6 characters.

<asp:textbox id="password1" TextMode="Password" Columns="45"
runat="server" /><asp:label text=" 6-20 characters with at least 1

numeric"
style="color:red" runat="server"/>
<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain between 6 and 20

characters!"
ValidationExpression="\w{6,20}"
Runat="Server" />

<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain at least one number and
letter!"
ValidationExpression="[a-zA-Z]+\w*\d+\w*"
Runat="Server" />

I can solve the problem by also putting a RequiredFieldValidator, it's

just
that that requires another object that shouldn't be needed (at least, I
wouldn't think so).

Tom


Nov 19 '05 #3
pj
On Fri, 4 Mar 2005 14:27:11 -0800, "tshad"
<ts**********@ftsolutions.com> wrote:
I have a RegularExpressionValidator that doesn't seem to work correctly if
you don't enter anything. In the following, it works correctly if you have
at least 1 character. If you just enter through the field it lets you (even
thoug no entry would be less that 6 characters.


Pretty irritating isn't it? The RegularExpressionValidator only
attempts to validate the control if there is something there. Ugly.

pj
--
http://www.psychedelicjones.com/
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andy Eshtry | last post by:
I have a radio button list, a textbox representing SIN or EIN based on my radio button list selection so I put 2 regularexpressionvalidator to evaluate the value of textbox. EIN must be (for...
3
by: Ricardo Corsi P. Cesar | last post by:
Hi, i looking for example in asp.net (VB) to make the RegularExpressionValidator in runtime in my code behind. I found some similars codes, but nothing in VB.. thanks!
3
by: DC | last post by:
I have this snippet: <tr> <td align="left">E-mail</td> <td> <asp:TextBox id="txtEmail" runat="server" MaxLength="100"></asp:TextBox>&nbsp; <asp:RegularExpressionValidator id="revEmail"...
1
by: franz | last post by:
does anybody tell me why it doesn't works?? in any case gg beame true thanks franz Dim y As RegularExpressionValidator = New RegularExpressionValidator y.ValidationExpression =...
3
by: Steven Berkovitz | last post by:
I was just wondering if there is a reason (maybe a RFC requirement?) that the built in email address regular expression for the RegularExpressionValidator in ASP.NET doesn't support email aliases...
4
by: =?Utf-8?B?Y3VyaW91cw==?= | last post by:
I am using a RegularExpressionValidator to validate a TextBox. I use "^?+(\.*)?$" to check for a real number. The control works fine as long as the user enters something in the TextBox; it does not...
2
by: Certys | last post by:
Hello, I have a form where I only allow new records to be added. I enable this by setting the form property "Data Entry" to Yes. I want to access other records in the same table- to autofill...
5
by: clintonG | last post by:
Two regular expression questions in a row -- we're on a roll here ;-) I have this... <asp:RegularExpressionValidator ID="Validator1" runat="server" ControlToValidate="TextBox1"...
7
by: CCHDGeek | last post by:
I have a subform that is searched according to a field value on the main form. The subform has mutiple pages and each page has a subform based off a query. Today when I logged into the main form,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.