ValidationExpression Error

Discussion in 'ASP .Net' started by skardian@gmail.com, Nov 17, 2006.

  1. Guest

    I am currently using the ChangePassword control for ASP.NET 2.0 to
    allow users to update or change their password as need be. However I am
    running into a problem with the Regular Expression Validation. I have
    tried the following code:

    ValidationExpression="[\w]{5,}"

    ValidationExpression="[\w|\d]{5,}"

    ValidationExpression="^[\w]{5,}$"

    ValidationExpression="^[\w|\d]{5,}$"

    ValidationExpression="\w{5,}"

    But each time the validation check ends. I am entering a password that
    is 9 characters long to test so I know it's not a length issue. So what
    exactly am I missing as from my research on the subject one of those
    above expressions should work for validating that the field is 5
    characters or more.

    -Steve
    , Nov 17, 2006
    #1
    1. Advertising

  2. Hey Steve,

    Try this one

    ^\w{5,}$
    --


    Bits. Bytes.
    http://bytes.thinkersroom.com
    ------------------------------


    "" wrote:

    > I am currently using the ChangePassword control for ASP.NET 2.0 to
    > allow users to update or change their password as need be. However I am
    > running into a problem with the Regular Expression Validation. I have
    > tried the following code:
    >
    > ValidationExpression="[\w]{5,}"
    >
    > ValidationExpression="[\w|\d]{5,}"
    >
    > ValidationExpression="^[\w]{5,}$"
    >
    > ValidationExpression="^[\w|\d]{5,}$"
    >
    > ValidationExpression="\w{5,}"
    >
    > But each time the validation check ends. I am entering a password that
    > is 9 characters long to test so I know it's not a length issue. So what
    > exactly am I missing as from my research on the subject one of those
    > above expressions should work for validating that the field is 5
    > characters or more.
    >
    > -Steve
    >
    >
    =?Utf-8?B?UmFkIFtWaXN1YWwgQyMgTVZQXQ==?=, Nov 17, 2006
    #2
    1. Advertising

  3. Guest

    Rad,

    Tried that one but it still errors out on me.

    <asp:RegularExpressionValidator ID="valPasswordLength" runat="server"
    ControlToValidate="NewPassword" SetFocusOnError="true"
    Display="Dynamic" ValidationExpression="^\w{5,}$" ErrorMessage="New
    Password must be at least 5 characters long." ToolTip="New Password
    must be at least 5 characters long."
    ValidationGroup="ChangePassword1">*
    </asp:RegularExpressionValidator>

    That is the Validator element of the asp:Changepassword control that I
    am using. Maybe something else in there is wrong but I just don't see
    what the problem is.

    Rad wrote:
    > Hey Steve,
    >
    > Try this one
    >
    > ^\w{5,}$
    > --
    >
    >
    > Bits. Bytes.
    > http://bytes.thinkersroom.com
    > ------------------------------
    >
    >
    > "" wrote:
    >
    > > I am currently using the ChangePassword control for ASP.NET 2.0 to
    > > allow users to update or change their password as need be. However I am
    > > running into a problem with the Regular Expression Validation. I have
    > > tried the following code:
    > >
    > > ValidationExpression="[\w]{5,}"
    > >
    > > ValidationExpression="[\w|\d]{5,}"
    > >
    > > ValidationExpression="^[\w]{5,}$"
    > >
    > > ValidationExpression="^[\w|\d]{5,}$"
    > >
    > > ValidationExpression="\w{5,}"
    > >
    > > But each time the validation check ends. I am entering a password that
    > > is 9 characters long to test so I know it's not a length issue. So what
    > > exactly am I missing as from my research on the subject one of those
    > > above expressions should work for validating that the field is 5
    > > characters or more.
    > >
    > > -Steve
    > >
    > >
    , Nov 17, 2006
    #3
  4. Hey Steve,

    If I understand you correctly you have a ChangePassword control on
    your form, and you want to validate the new password such that it is
    at least 5 characters.

    I've recreated the scenario on my PC. What you want to do is put the
    regular expression ,^\w{5,}$, in the property
    NewPasswordRegularExpression.

    If you view source at this point your control's source should be as
    follows:

    <asp:ChangePassword ID="ChangePassword1" runat="server"
    NewPasswordRegularExpression='^\w{5,}$'>
    </asp:ChangePassword>

    Try that out and let me know if it works. I've been able to test it on
    my PC and it works like poetry



    On 17 Nov 2006 08:23:58 -0800, wrote:

    >Rad,
    >
    >Tried that one but it still errors out on me.
    >
    ><asp:RegularExpressionValidator ID="valPasswordLength" runat="server"
    >ControlToValidate="NewPassword" SetFocusOnError="true"
    >Display="Dynamic" ValidationExpression="^\w{5,}$" ErrorMessage="New
    >Password must be at least 5 characters long." ToolTip="New Password
    >must be at least 5 characters long."
    >ValidationGroup="ChangePassword1">*
    ></asp:RegularExpressionValidator>
    >
    >That is the Validator element of the asp:Changepassword control that I
    >am using. Maybe something else in there is wrong but I just don't see
    >what the problem is.

    --

    Bits.Bytes.
    http://bytes.thinkersroom.com
    Rad [Visual C# MVP], Nov 17, 2006
    #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. =?Utf-8?B?T2xpdmVyIFNjaHVsemU=?=

    ValidationExpression Syntax

    =?Utf-8?B?T2xpdmVyIFNjaHVsemU=?=, May 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,193
    =?Utf-8?B?T2xpdmVyIFNjaHVsemU=?=
    May 12, 2004
  2. =?Utf-8?B?SklNLkgu?=

    ValidationExpression

    =?Utf-8?B?SklNLkgu?=, Nov 17, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    8,203
    Peter Blum
    Nov 18, 2004
  3. TD
    Replies:
    3
    Views:
    8,697
  4. Nathan Sokalski
    Replies:
    2
    Views:
    886
    Nathan Sokalski
    Jan 3, 2007
  5. Morten71
    Replies:
    0
    Views:
    609
    Morten71
    Apr 2, 2007
Loading...

Share This Page