RE: Help: RequiredFieldValidator doesn't work in non-IE browsers
From: Cowboy (Gregory A. Beamer) - MVP (NoSpamMgbworld_at_comcast.netNoSpamM)
Date: 11/08/04
- Next message: Ed Chiu: "Can regular expression validation do this?"
- Previous message: Ken Varn: "When can ViewState be disabled in WebServer controls?"
- In reply to: Joe: "Help: RequiredFieldValidator doesn't work in non-IE browsers"
- Next in thread: Tampa .NET Koder: "RE: Help: RequiredFieldValidator doesn't work in non-IE browsers"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 8 Nov 2004 10:35:03 -0800
Some validators only work on the server side. Whether the validator works on
client or not, you should test server side regardless. You can see the
validator in question works on server side, if you test it. Check if IsValid
in your server side code.
---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Joe" wrote:
> Hello,
>
> I have created a login page using dotnet. I am using requiredFieldValidator
> and noticed that the code works fine in IE but not in Netscape, Opera,
> Mozilla, Firefox, etc.
>
> For example if I do not enter anything in the form in IE, then form won't be
> submitted but in other browsers it is submitted.
>
> I checked that JavaScript is enabled in Netscape, Opera, Mozilla, Firefox,
> etc. and still the form doesn't work in these browsers.
>
> Is there any way I can make this code work in other browsers? I am using
> VB.NET for coding and not C#, so please suggest a solution in VB.NET.
>
> Thanks in advance for you help,
>
> Joe
>
> Here is my code,
>
> <table width="100%" border="0" cellpadding="2" cellspacing="2">
> <tr valign="top">
> <td height="40" colspan="3"
> class="subsubTitle"><font color="#993333"> All fields are
> required.</font></td>
> </tr>
> <tr>
> <td width="10%" class="hometext"><b>User
> ID</b></td>
> <td width="1%" class="hometext">:</td>
> <td width="89%" class="grey">
> <asp:TextBox ID="txtUserID" columns="25" runat="server" />
> <asp:RequiredFieldValidator
> id="RequiredFieldValidatorUID" runat="server"
> ErrorMessage="Please enter User ID." Display="None"
> ControlToValidate="txtUserID" />
> <asp:CompareValidator id="valRequiredUID" runat="server"
> ControlToValidate="txtUserID"
> ValueToCompare="007"
> Type="String"
> Operator="Equal"
> ErrorMessage="Please enter correct UserID."
> Display="dynamic">
> </asp:CompareValidator>
> </td>
> </tr>
> <tr>
> <td class="hometext"><b>Password</b></td>
> <td class="hometext">:</td>
> <td class="grey"><asp:TextBox ID="txtPwd"
> Columns="25" runat="server" />
>
> <asp:RequiredFieldValidator
> id="RequiredFieldValidatorPwd" runat="server"
> ErrorMessage="Please enter correct password." Display="None"
> ControlToValidate="txtPwd" />
> <asp:CompareValidator id="valRequiredPwd" runat="server"
> ControlToValidate="txtPwd"
> ValueToCompare="007"
> Type="String"
> Operator="Equal"
> ErrorMessage="Please enter correct password." Display="dynamic">
> </asp:CompareValidator>
> <asp:ValidationSummary id="ValidationSummary1"
> ShowMessageBox="True" ShowSummary="False" runat="server"/>
> </td>
> </tr>
> <tr>
> <td class="hometext"><b>Name</b></td>
> <td class="hometext">:</td>
> <td class="grey"><asp:TextBox id="txtName"
> columns="25" runat="server" />
> <asp:RequiredFieldValidator
> ID="RequiredFieldValidatorName" runat="server"
> ErrorMessage="Please enter your name." Display="None"
> ControlToValidate="txtName" />
> </td>
> </tr>
> <tr>
> <td class="hometext"><b>Company</b></td>
> <td class="hometext">:</td>
> <td class="grey"><asp:TextBox
> id="txtCompany" columns="25" runat="server" />
> <asp:RequiredFieldValidator
> id="RequiredFieldValidatorCompany" runat="server"
> ErrorMessage="Please enter your Company name." Display="None"
> ControlToValidate="txtCompany" />
> </td>
> </tr>
> <tr>
> <td class="hometext"><b>Email</b></td>
> <td class="hometext">:</td>
> <td class="grey"><asp:TextBox
> id="txtEmail" columns="25" runat="server" />
> <asp:RequiredFieldValidator
> id="RequiredFieldValidatorEmail" runat="server"
> ErrorMessage="Please enter your Email address." Display="None"
> ControlToValidate="txtEmail" />
>
> <asp:RegularExpressionValidator id="valValidEmail" runat="server"
> ControlToValidate="txtEmail"
>
> ValidationExpression="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
> ErrorMessage="Invalid Email address."
> Display="None">
> </asp:RegularExpressionValidator>
> </td>
> </tr>
> <tr>
> <td colspan="3" height="1"><img
> src="../images/spacer.gif" width="2" height="1"></td>
> </tr>
> <tr>
> <td colspan="3" class="grey"></td>
> </tr>
> <tr>
> <td colspan="3" height="1"><img
> src="../images/spacer.gif" width="2" height="1"></td>
> </tr>
> <tr>
> <td class="grey" colspan="3"><div
> align="left">
> <table width="100%" border="0"
> cellspacing="0" cellpadding="2">
> <tr>
> <td width="12%"
> class="hometext"><asp:Button id="btnSubmit" OnClick="submit" Text="Login"
> runat="server" /></td>
> <td width="88%"
> class="hometext"> </td>
> </tr>
> </table>
> </div></td>
> </tr>
> </table>
>
- Next message: Ed Chiu: "Can regular expression validation do this?"
- Previous message: Ken Varn: "When can ViewState be disabled in WebServer controls?"
- In reply to: Joe: "Help: RequiredFieldValidator doesn't work in non-IE browsers"
- Next in thread: Tampa .NET Koder: "RE: Help: RequiredFieldValidator doesn't work in non-IE browsers"
- Messages sorted by: [ date ] [ thread ]