ValidationExpression Error

  • Thread starter Thread starter skardian
  • Start date Start date
S

skardian

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
 
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.
Hey Steve,

Try this one

^\w{5,}$
--


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


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
 
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
 
Back
Top