Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Validation control problem

Reply
Thread Tools

Validation control problem

 
 
fniles
Guest
Posts: n/a
 
      04-27-2007
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>


 
Reply With Quote
 
 
 
 
Page Brooks
Guest
Posts: n/a
 
      04-27-2007
I copied your code verbatim into a project and it appears to work fine for
me.

--
Page Brooks
www.explosivedog.com


"fniles" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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>
>
>



 
Reply With Quote
 
 
 
 
clintonG
Guest
Posts: n/a
 
      04-27-2007
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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>
>
>



 
Reply With Quote
 
fiefie.niles@gmail.com
Guest
Posts: n/a
 
      04-28-2007
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" <(E-Mail Removed)> wrote:
> 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" <(E-Mail Removed)> wrote in message
>
> news:%(E-Mail Removed)...
>
>
>
> >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 -



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PasswordRecovery control trips Login control's validation The Colonel ASP .Net 1 07-06-2006 09:18 PM
Using Summary Validation control with server Custom validation =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= ASP .Net 2 10-15-2004 06:15 PM
Form Validation Problem...Persisiting form fields on validation failure. bnp Javascript 4 05-12-2004 12:16 PM
Displaying a Validation Error in a Validation Summary Control Lucas Tam ASP .Net 2 02-26-2004 07:49 PM
Re: only custom validation control does server side validation? Colin Mackay ASP .Net 0 06-25-2003 07:54 AM



Advertisments