Validation control problem

Discussion in 'ASP .Net' started by fniles, Apr 27, 2007.

  1. fniles

    fniles Guest

    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>
    fniles, Apr 27, 2007
    #1
    1. Advertising

  2. fniles

    Page Brooks Guest

    I copied your code verbatim into a project and it appears to work fine for
    me.

    --
    Page Brooks
    www.explosivedog.com


    "fniles" <> wrote in message
    news:%...
    >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>
    >
    >
    Page Brooks, Apr 27, 2007
    #2
    1. Advertising

  3. fniles

    clintonG Guest

    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" <> wrote in message
    news:%...
    >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>
    >
    >
    clintonG, Apr 27, 2007
    #3
  4. fniles

    Guest

    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" <> 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" <> wrote in message
    >
    > news:%...
    >
    >
    >
    > >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, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin Mackay
    Replies:
    0
    Views:
    2,678
    Colin Mackay
    Jun 25, 2003
  2. Libs
    Replies:
    0
    Views:
    1,483
  3. Lucas Tam
    Replies:
    2
    Views:
    1,091
    Lucas Tam
    Feb 26, 2004
  4. =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=

    Using Summary Validation control with server Custom validation

    =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=, Oct 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    871
    =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=
    Oct 15, 2004
  5. bnp
    Replies:
    4
    Views:
    294
Loading...

Share This Page