ASP.NET Validation controls and Firefox/Netscape 7.1

G

Guest

All,

I have a ASP.NET/C# webform thats contains some validation controls. When I
view this page in IE the control work fine and validates the user's input.

When I view the same page in firefox 1.0 or Netscape the validation controls
do not work at all and an exception is display.

How can I make the validation controls work in Firefox/Netscape 7.1?

Thanks
Msuk
 
K

Karl Seguin

The ASP.Net validations only work client side in IE. You can make them work
server side in other browsers, via something like:

Sub SomeButton_Click(...)
Page.Validate()
If Page.IsValid Then
... normal stuff here
end if
end sub

Or, you can use 3rd party controls which do work in Netscape, such as Paul
Glavich's great DOMValidators (free)
http://aspalliance.com/glav/downloads/domvalidators.zip

Karl
 
J

John M Deal

I have a theory on this that I haven't been able to test out yet where I
think it may be related to browsercaps. Browser caps is where the
ASP.Net server thinks that it is dealing with a browser that has the
full capabilities of a newer browser vs the limited capabilities of an
older browser. The reason I think this might be the case is because I
have found that in FireFox the page's form's onSubmit attribute is not
set to cancel the submit if the page isn't valid, IE has this attribute
set so it would seem that at least that part may have something to do
with browser caps settings.

The only way to find out would be to try and see if modifying the
browser caps settings will work. Like I said this is only a theory of
mine at this point and I don't have the time right now to test it out.
Here's a link to a site that has some additional information on this.
Hope it helps.

http://weblogs.asp.net/mrupp/archive/2003/04/03/4789.aspx

Have A Better One!

John M Deal, MCP
Necessity Software

P.S. One of these days I'll actually test this out and either prove or
disprove this theory. If you try it out please post your results.
 
P

Peter Blum

Hi John,

Why do the test when the answer of why FireFox doesn't work is well known?
Microsoft wrote their scripts in DHTML. Specifically, they use
document.all[] instead of document.getElementById() to access the <span>
tags that represent the validators.

This article discusses it in detail:
http://aspnet.4guysfromrolla.com/articles/051204-1.aspx

Another third party solution is "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx). Its 22 validators provide
client-side validation on IE, IE/Mac, Netscape 7, Mozilla, FireFox, Opera 7
and Safari.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
J

John M Deal

Thanks for the info. The reason I wanted to test it out was that I
wasn't aware that it was a well known issue, and once I find out about a
problem I like to know the answer to see if I can fix it. With over
three years of professional .Net (primarily ASP.Net) experience I'm not
a newbie, I just never dug into it as it hasn't been relevant to the
projects I've been working on (mostly intranet applications) and I
always use both server and client side validations as it is way too easy
to bypass a web based interface.

Thanks for the links, I'll have to read up on this more. Also I'll keep
it in mind if someone asks again (there were actually two different
people asking on this newsgroup in the last couple of days alone).
Thanks again.

Have A Better One!

John M Deal, MCP
Necessity Software

P.S. Pretty sweet way to plug your own product. I'll have to remember
that when ours comes out (I keep forgetting it is perfectly legit when
it applies to the question being asked).

Peter said:
Hi John,

Why do the test when the answer of why FireFox doesn't work is well known?
Microsoft wrote their scripts in DHTML. Specifically, they use
document.all[] instead of document.getElementById() to access the <span>
tags that represent the validators.

This article discusses it in detail:
http://aspnet.4guysfromrolla.com/articles/051204-1.aspx

Another third party solution is "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx). Its 22 validators provide
client-side validation on IE, IE/Mac, Netscape 7, Mozilla, FireFox, Opera 7
and Safari.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

I have a theory on this that I haven't been able to test out yet where I
think it may be related to browsercaps. Browser caps is where the ASP.Net
server thinks that it is dealing with a browser that has the full
capabilities of a newer browser vs the limited capabilities of an older
browser. The reason I think this might be the case is because I have found
that in FireFox the page's form's onSubmit attribute is not set to cancel
the submit if the page isn't valid, IE has this attribute set so it would
seem that at least that part may have something to do with browser caps
settings.

The only way to find out would be to try and see if modifying the browser
caps settings will work. Like I said this is only a theory of mine at this
point and I don't have the time right now to test it out. Here's a link to
a site that has some additional information on this. Hope it helps.

http://weblogs.asp.net/mrupp/archive/2003/04/03/4789.aspx

Have A Better One!

John M Deal, MCP
Necessity Software

P.S. One of these days I'll actually test this out and either prove or
disprove this theory. If you try it out please post your results.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top