473,508 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validation control problem

I am using a Regular Expression Validator and expression ^.{4,8}$ but even
when I type in "asdf",
"1234", or "asdf1234" when I click on the submit button it keeps giving me
the error "Password must be between 4 and 8 characters in length". What did
I do wrong in the following Page1.aspx ? Thank you.

<body>
<form id="form1" runat="server">
<div>
<input id="txtPassword" runat=server type="password" />&nbsp;
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtPassword"
ErrorMessage="Password must be between 4 and 8 characters in length"
ValidationExpression="^.{4,8}$"></asp:RegularExpressionValidator>
<br />
<asp:Button ID="txtSubmit" runat="server" Text="Submit" /></div>
</form>
</body>
Apr 27 '07 #1
3 1128
I copied your code verbatim into a project and it appears to work fine for
me.

--
Page Brooks
www.explosivedog.com
"fniles" <fn****@pfmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>I am using a Regular Expression Validator and expression ^.{4,8}$ but even
when I type in "asdf",
"1234", or "asdf1234" when I click on the submit button it keeps giving me
the error "Password must be between 4 and 8 characters in length". What
did
I do wrong in the following Page1.aspx ? Thank you.

<body>
<form id="form1" runat="server">
<div>
<input id="txtPassword" runat=server type="password" />&nbsp;
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtPassword"
ErrorMessage="Password must be between 4 and 8 characters in length"
ValidationExpression="^.{4,8}$"></asp:RegularExpressionValidator>
<br />
<asp:Button ID="txtSubmit" runat="server" Text="Submit" /></div>
</form>
</body>


Apr 27 '07 #2
Ironic how I was just asking for help myself but I think the validator is
only seeing parting of the expression.
I would try this ^[.]{4,8}$ and note we can test the validation much faster
in the page by tabbing out of the textbox.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/


"fniles" <fn****@pfmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>I am using a Regular Expression Validator and expression ^.{4,8}$ but even
when I type in "asdf",
"1234", or "asdf1234" when I click on the submit button it keeps giving me
the error "Password must be between 4 and 8 characters in length". What
did
I do wrong in the following Page1.aspx ? Thank you.

<body>
<form id="form1" runat="server">
<div>
<input id="txtPassword" runat=server type="password" />&nbsp;
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtPassword"
ErrorMessage="Password must be between 4 and 8 characters in length"
ValidationExpression="^.{4,8}$"></asp:RegularExpressionValidator>
<br />
<asp:Button ID="txtSubmit" runat="server" Text="Submit" /></div>
</form>
</body>


Apr 27 '07 #3
I use ^.{4,8}$ in another project and it works. I don't know why it
did not work in the other project. THank you for your help.

On Apr 27, 3:06 pm, "clintonG" <nob...@nowhere.comwrote:
Ironic how I was just asking for help myself but I think the validator is
only seeing parting of the expression.
I would try this ^[.]{4,8}$ and note we can test thevalidationmuch faster
in the page by tabbing out of the textbox.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URLhttp://clintongallagher.metromilwaukee.com/

"fniles" <fni...@pfmail.comwrote in message

news:%2****************@TK2MSFTNGP06.phx.gbl...
I am using a Regular Expression Validator and expression ^.{4,8}$ but even
when I type in "asdf",
"1234", or "asdf1234" when I click on the submit button it keeps giving me
the error "Password must be between 4 and 8 characters in length". What
did
I do wrong in the following Page1.aspx ? Thank you.
<body>
<form id="form1" runat="server">
<div>
<input id="txtPassword" runat=server type="password" />&nbsp;
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtPassword"
ErrorMessage="Password must be between 4 and 8 characters in length"
ValidationExpression="^.{4,8}$"></asp:RegularExpressionValidator>
<br />
<asp:Button ID="txtSubmit" runat="server" Text="Submit" /></div>
</form>
</body>- Hide quoted text -

- Show quoted text -

Apr 28 '07 #4

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

Similar topics

14
6268
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
3
2990
by: Ben | last post by:
Hi, I have a page with a datagrid that you have to scroll to see. I'm using the StrengthControls SmartScroller as recommended to maintain my scroll position. Anyway, inside the datagrid I have...
2
3978
by: Martyn Fewtrell | last post by:
Dear All I have a Windows 2003 Server with IIS6 where the validation controls on ASP.Net pages no longer work. I believe it to be specific to the server as if I create an ASP.Net page on the...
5
3224
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and...
9
3164
by: Bill Long | last post by:
I have a control that simply displays a list of links. Following one of the links doesn't post back or redirect to another page, it simply hides the current panel and shows the one you selected......
5
2028
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
2
6689
by: Tim Frawley | last post by:
Source code attached indicates my problem with validation and a button bar save button. Fill the Textbox with some text then tab off the control. The message box will display the text in the...
4
1540
by: Lloyd Dupont | last post by:
I am writing a 'blog control' which, amongst other things, let you edit some HTML text. When it's submited back there are validation problem and to my... *Horrible Disbelief* it seems I can only...
1
1805
by: Buddy Ackerman | last post by:
I don't know what the problem is. I have a form with several controls that need to be validated, I put a validation group in every form control, every validatoino control, the submit button and...
2
4492
by: dustbort | last post by:
I recently had a problem where my required field validator stopped working. But, the page still posted back and tried to insert a record into the database without performing server-side validation....
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7382
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5052
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.