T
tshad
Is there a way to tell the validators to not fire if one of the validators
fails the input?
For example:
In the following code, if someone doesn't enter anything in the field, I
should get the message " A password must be entered".
I am also getting the message that I need " 1 numeric", "the passwords don't
match" and "I need from 6 - 20 characters".
I would like to only get the first message, which ever it is.
*********************************************************************************
<tr valign="baseline">
<td align="right" valign="middle" nowrap>Password:</td>
<td>
<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:RequiredFieldValidator id="RequiredFieldValidator"
ControlToValidate="password1"
Display="Dynamic"
ErrorMessage="A password must be entered!"
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" />
</td>
</tr>
</div>
<div id="retypePassword" visible="false" runat="server">
<tr valign="baseline">
<td align="right" valign="middle" nowrap>Retype Password:</td>
<td>
<asp:textbox id="password2" TextMode="Password" Columns="45"
runat="server" />
<asp:CompareValidator
ControlToValidate="password1"
ControlToCompare="password2"
Display="Dynamic"
Text="<br>Your passwords don't match!"
Operator="Equal"
Type="String"
Runat="Server" />
</td>
</tr>
**************************************************************************
Thanks,
Tom
fails the input?
For example:
In the following code, if someone doesn't enter anything in the field, I
should get the message " A password must be entered".
I am also getting the message that I need " 1 numeric", "the passwords don't
match" and "I need from 6 - 20 characters".
I would like to only get the first message, which ever it is.
*********************************************************************************
<tr valign="baseline">
<td align="right" valign="middle" nowrap>Password:</td>
<td>
<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:RequiredFieldValidator id="RequiredFieldValidator"
ControlToValidate="password1"
Display="Dynamic"
ErrorMessage="A password must be entered!"
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" />
</td>
</tr>
</div>
<div id="retypePassword" visible="false" runat="server">
<tr valign="baseline">
<td align="right" valign="middle" nowrap>Retype Password:</td>
<td>
<asp:textbox id="password2" TextMode="Password" Columns="45"
runat="server" />
<asp:CompareValidator
ControlToValidate="password1"
ControlToCompare="password2"
Display="Dynamic"
Text="<br>Your passwords don't match!"
Operator="Equal"
Type="String"
Runat="Server" />
</td>
</tr>
**************************************************************************
Thanks,
Tom