I need help with my registration form. It was working fine until I added a RegularExpressionValidator. Now it seems I can enter whatever I want in any field I want, and the form submits without error. Even If I take out the RegularExpressionValidator none of the other code is working now. It just submits the form without error, no matter what bad info I enter.
Can someone help me debut this code?
Here's the form code:
<form runat="server" name="register">
<div align="left"> </div>
<table width="100%" border="0">
<tr valign="top">
<td width="27%" class="body">Username:</td>
<td width="73%" class="body"><asp:TextBox id="MAJOR_KEY" runat="server"></asp:TextBox></td>
</tr>
<tr valign="top">
<td class="body"><br>
Choose a Password:</td>
<td class="body"><br> <asp:TextBox id="PASSWORD" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator id="PASSWORDReqVal" runat="server" Display="Dynamic" ErrorMessage="Password. " ControlToValidate="PASSWORD" Font-Size="12" Font-Name="Verdana">
*</asp:RequiredFieldValidator></td>
</tr>
<tr valign="top">
<td class="body">Confirm Password:</td>
<td class="body"><asp:TextBox id="PASSWORD2" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator id="PASSWORD2ReqVal" runat="server" Display="Dynamic" ErrorMessage="Re-enter Password. " ControlToValidate="PASSWORD2" Font-Size="12" Font-Name="Verdana">
*</asp:RequiredFieldValidator> <asp:CompareValidator id="CompareValidatorPASSWORD2" runat="server" Display="Static" ErrorMessage="Re-enter Password. " ControlToValidate="PASSWORD2" Font-Size="11" Font-Name="Arial" ControlToCompare="PASSWORD">
Password fields don't match</asp:CompareValidator> </td>
</tr>
onSubmit="return validatePwd()"
<tr valign="top">
<td class="body"><br>
Enter your Email address:</td>
<td class="body"><br> <asp:TextBox id="EMAIL" runat="server"></asp:TextBox> <asp:RequiredFieldValidator id="EMAILReqVal" runat="server" Display="Dynamic" ErrorMessage="Email. " ControlToValidate="EMAIL" Font-Size="12" Font-Name="Verdana">*</asp:RequiredFieldValidator> <asp:RegularExpressionValidator id="EMAILRegexVal" runat="server" Display="Static" ErrorMessage="Email. " ControlToValidate="EMAIL" Font-Size="11" Font-Name="Arial" ValidationExpression="^[\w-]+@[\w-]+\.(com|net|org|edu|mil)$">Not a valid e-mail address. Must follow email@host.domain</asp:RegularExpressionValidator></td>
</tr>
<tr valign="top">
<td class="body">Confirm Email address:</td>
<td class="body"><asp:TextBox id="EMAIL2" runat="server"></asp:TextBox> <asp:RequiredFieldValidator id="EMAIL2ReqVal" runat="server" Display="Dynamic" ErrorMessage="Re-enter Password. " ControlToValidate="EMAIL2" Font-Size="12" Font-Name="Verdana">*</asp:RequiredFieldValidator> <asp:CompareValidator id="CompareValidatorEMAIL2" runat="server" Display="Static" ErrorMessage="Re-enter Password. " ControlToValidate="EMAIL2" Font-Size="11" Font-Name="Arial" ControlToCompare="EMAIL">Email fields don't match.</asp:CompareValidator></td>
</tr>
<tr valign="top">
<td> </td>
<td><asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Register"></asp:Button></td>
</tr>
</table>
</form>
Can someone help me debut this code?
Here's the form code:
<form runat="server" name="register">
<div align="left"> </div>
<table width="100%" border="0">
<tr valign="top">
<td width="27%" class="body">Username:</td>
<td width="73%" class="body"><asp:TextBox id="MAJOR_KEY" runat="server"></asp:TextBox></td>
</tr>
<tr valign="top">
<td class="body"><br>
Choose a Password:</td>
<td class="body"><br> <asp:TextBox id="PASSWORD" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator id="PASSWORDReqVal" runat="server" Display="Dynamic" ErrorMessage="Password. " ControlToValidate="PASSWORD" Font-Size="12" Font-Name="Verdana">
*</asp:RequiredFieldValidator></td>
</tr>
<tr valign="top">
<td class="body">Confirm Password:</td>
<td class="body"><asp:TextBox id="PASSWORD2" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator id="PASSWORD2ReqVal" runat="server" Display="Dynamic" ErrorMessage="Re-enter Password. " ControlToValidate="PASSWORD2" Font-Size="12" Font-Name="Verdana">
*</asp:RequiredFieldValidator> <asp:CompareValidator id="CompareValidatorPASSWORD2" runat="server" Display="Static" ErrorMessage="Re-enter Password. " ControlToValidate="PASSWORD2" Font-Size="11" Font-Name="Arial" ControlToCompare="PASSWORD">
Password fields don't match</asp:CompareValidator> </td>
</tr>
onSubmit="return validatePwd()"
<tr valign="top">
<td class="body"><br>
Enter your Email address:</td>
<td class="body"><br> <asp:TextBox id="EMAIL" runat="server"></asp:TextBox> <asp:RequiredFieldValidator id="EMAILReqVal" runat="server" Display="Dynamic" ErrorMessage="Email. " ControlToValidate="EMAIL" Font-Size="12" Font-Name="Verdana">*</asp:RequiredFieldValidator> <asp:RegularExpressionValidator id="EMAILRegexVal" runat="server" Display="Static" ErrorMessage="Email. " ControlToValidate="EMAIL" Font-Size="11" Font-Name="Arial" ValidationExpression="^[\w-]+@[\w-]+\.(com|net|org|edu|mil)$">Not a valid e-mail address. Must follow email@host.domain</asp:RegularExpressionValidator></td>
</tr>
<tr valign="top">
<td class="body">Confirm Email address:</td>
<td class="body"><asp:TextBox id="EMAIL2" runat="server"></asp:TextBox> <asp:RequiredFieldValidator id="EMAIL2ReqVal" runat="server" Display="Dynamic" ErrorMessage="Re-enter Password. " ControlToValidate="EMAIL2" Font-Size="12" Font-Name="Verdana">*</asp:RequiredFieldValidator> <asp:CompareValidator id="CompareValidatorEMAIL2" runat="server" Display="Static" ErrorMessage="Re-enter Password. " ControlToValidate="EMAIL2" Font-Size="11" Font-Name="Arial" ControlToCompare="EMAIL">Email fields don't match.</asp:CompareValidator></td>
</tr>
<tr valign="top">
<td> </td>
<td><asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Register"></asp:Button></td>
</tr>
</table>
</form>