469,338 Members | 8,242 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

Netscape validation problem

Hi. I've posted this question on another newsgroup, but I haven't received any answers..

I have a login page where users input userID and password and click a Login button. Before calling the login functions, I have to check the user ID and the password for invalid data. It works well in IExplorer, but it doesn't show the validation summary (displayed in a Javascript alert box) in Netscape.

This is what I have in the asp page:

<asp:textbox id="txtUserID" MaxLength="30" runat="server"></asp:textbox><asp:requiredfieldvalidator id="validUserID" runat="server" controlToValidate="txtUserID" ErrorMessage="User ID is required" Display="None"></asp:requiredfieldvalidator><asp:textbox id="txtUserPwd" MaxLength="30" runat="server"></asp:textbox><asp:requiredfieldvalidator id="validUserPwd" runat="server" ErrorMessage="Password is required" Display="None" ControlToValidate="txtUserPwd"></asp:requiredfieldvalidator><asp:button id="btnLogin" runat="server" Text="Login"></asp:button><asp:validationsummary id="validSummary" runat="server" DisplayMode="BulletList" HeaderText="The following errors ocured:" showsummary="false" ShowMessageBox="True"></asp:validationsummary>

This is what I have in my code-behind file:

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click

If Not Page.IsValid Then
Return
End If

'Call the login function
End Sub

Does anyone have any idea why the validation summary doesn't show in netscape

TI
TM
Nov 18 '05 #1
2 1240
The client-side validation that the built-in validators are supposed to be
executing does not work in Netscape because of the way the relevant
javascript was written. Your server-side validation is not running because
you are not calling Page.Validate prior to evaluating Page.IsValid. Adding
a call to the Validate method prior to using the IsValid property should fix
the immediate problem.

BTW, even if Netscape were not an issue, you should be performing the
server-side validation properly since client-side validation is trivial to
bypass.

HTH,
Nicole
"TIBM" <an*******@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.com...
Hi. I've posted this question on another newsgroup, but I haven't received
any answers...

I have a login page where users input userID and password and click a
Login button. Before calling the login functions, I have to check the
user ID and the password for invalid data. It works well in IExplorer, but
it doesn't show the validation summary (displayed in a Javascript alert
box) in Netscape.

This is what I have in the asp page:

<asp:textbox id="txtUserID" MaxLength="30"
runat="server"></asp:textbox><asp:requiredfieldvalidator id="validUserID"
runat="server" controlToValidate="txtUserID" ErrorMessage="User ID is
required" Display="None"></asp:requiredfieldvalidator><asp:textbox
id="txtUserPwd" MaxLength="30"
runat="server"></asp:textbox><asp:requiredfieldvalidator id="validUserPwd"
runat="server" ErrorMessage="Password is required" Display="None"
ControlToValidate="txtUserPwd"></asp:requiredfieldvalidator><asp:button
id="btnLogin" runat="server"
Text="Login"></asp:button><asp:validationsummary id="validSummary"
runat="server" DisplayMode="BulletList" HeaderText="The following errors
ocured:" showsummary="false"
ShowMessageBox="True"></asp:validationsummary>

This is what I have in my code-behind file:

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogin.Click

If Not Page.IsValid Then
Return
End If

'Call the login functions
End Sub

Does anyone have any idea why the validation summary doesn't show in
netscape?

TIA
TM

Nov 18 '05 #2
Sorry, I hadn't noticed that you were using the message box approach for the
validation summary. There's an additional problem with this: the message
box is only shown when the form is submitted, at which point it appears
valid since client-side validation "passes" in Netscape. There is a
workaround, but it won't work for any client that has javascript enabled
since the message is displayed using a client-side window.alert call. A
more robust approach is use the in-place text display rather than the
message box for showing the validation summary.

HTH,
Nicole

"TIBM" <an*******@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
Actually, it didn't work...
Any other ideas?
Thanks. TIBM

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by rez | last post: by
1 post views Thread by Mike George | last post: by
3 posts views Thread by Masoud Amiri | last post: by
reply views Thread by interuser | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.