T
tshad
I have a RegularExpressionValidator that doesn't seem to work correctly if
you don't enter anything. In the following, it works correctly if you have
at least 1 character. If you just enter through the field it lets you (even
thoug no entry would be less that 6 characters.
<asp:textbox id="password1" TextMode="Password" Columns="45"
runat="server" /><asp:label text=" 6-20 characters with at least 1 numeric"
style="color:red" runat="server"/>
<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain between 6 and 20 characters!"
ValidationExpression="\w{6,20}"
Runat="Server" />
<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain at least one number and
letter!"
ValidationExpression="[a-zA-Z]+\w*\d+\w*"
Runat="Server" />
I can solve the problem by also putting a RequiredFieldValidator, it's just
that that requires another object that shouldn't be needed (at least, I
wouldn't think so).
Tom
you don't enter anything. In the following, it works correctly if you have
at least 1 character. If you just enter through the field it lets you (even
thoug no entry would be less that 6 characters.
<asp:textbox id="password1" TextMode="Password" Columns="45"
runat="server" /><asp:label text=" 6-20 characters with at least 1 numeric"
style="color:red" runat="server"/>
<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain between 6 and 20 characters!"
ValidationExpression="\w{6,20}"
Runat="Server" />
<asp:RegularExpressionValidator
ControlToValidate="password1"
Display="Dynamic"
Text="<br>Your password must contain at least one number and
letter!"
ValidationExpression="[a-zA-Z]+\w*\d+\w*"
Runat="Server" />
I can solve the problem by also putting a RequiredFieldValidator, it's just
that that requires another object that shouldn't be needed (at least, I
wouldn't think so).
Tom