views:

243

answers:

3

I have a WebForms app that uses a field validator on a dropdownlist. It works in IE but not FireFox.

This is pretty straightforward stuff I'm doing. Here are the setups for the dropdown and validator:

<asp:DropDownList ID ="dmbFileActNo" runat="server" CssClass="DROPDOWN_MEDIUM" AutoPostBack="True"></asp:DropDownList>

<asp:requiredfieldvalidator EnableClientScript="true" id="rfvFileActNo" Display="None" ControlToValidate="dmbFileActNo" Runat="server"  InitialValue="-1"></asp:requiredfieldvalidator>

I'm running ASP.Net 2.0 on the web server. Javascript is enabled on the FireFox browser-- this problem happens on all FF browsers I've tested, on multiple everyday machines, so I don't believe it's due to a locked down install.

+1  A: 

Sometimes ASP.net sends different HTML/ javascript to different browsers. Check your browsercap file/settings

ggonsalv
+2  A: 

Client-side validation may not work in all browsers and in all scenarios. It's important to make sure that you always do validation on the server as well.

You may also want to take a look at what the DetermineRenderUpLevel() method on your validation control is returning in FF. Behind the scenes, it checks to see that the following are true:

  • The browser has client script enabled.
  • The W3CDomVersion property of the HttpBrowserCapabilitiesBase object that is stored in the HttpRequest.Browser property is 1 or later.
  • The EcmaScriptVersion property of the HttpBrowserCapabilitiesBase object that is stored in the HttpRequest.Browser property is 1.2 or later.
Andy West
A: 

I got this working by modifying the web.config. As it turns out, someone had <xhtmlConformance mode="Legacy"/> in there, which is an older setting (the current default is "transitional"). Thanks for everyone's help.

larryq