views:

1835

answers:

2

This one has been a stumper for me. Its very easy to duplicate though a rather obscure issue. It came about as I was doing some javascript work on a web page yet also make use of the validation controls that ASP.NET provides.

Some specifics up front: using a Vista-based development machine with the 3.5 framework and IIS 7. I also have a QA machine that is running windows server 2003, also with the 3.5 framework but running IIS 6.

Take a page with a simple TextBox, Validation Control, and button to submit them. For example:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Text is Required" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>  
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />

Simple ASP.NET validation control code here ... The idea here is that client-side validation code is generated for the required field and a postback is not done unless the text box has a field. If the browser does not support client-side scripting, then ASP.NET will catch it on the server side using the Page.IsValid property.

When I run this from my Vista-based development machine, the client-side scripting code is generated for both IE and Firefox and works just fine.

When I run from the win2003-based QA machine, client side code for the validator controls is also generated for both browsers. The validation code for IE works fine ... but does Not work for Firefox. When the submit button is pressed (with an empty text box), the client-side code appears to be ignored and a postback performed. Now the validation error is caught server side - but I want to know why its not working client side in the first place.

The interesting quirk here is that if I take page source views under Firefox from the Development machine (the one that works) and the QA machine (the one that doesn't) and compare them - the client side validation code is dramatically different.

Ideas on what to change to get the client side validation code to work in Firefox with the QA machine?

UPDATE: Had a few comments asking to see the generated source. I've saved the Dev and QA source as .htm files and zipped them up. You can get them at http://www.optsolutions.com/testvalidation.zip

A: 

I am having the same issue with a similar setup. Differences in the browserCaps settings is the most promising possibility I have come across so far.

http://msdn.microsoft.com/en-us/library/sk9az15a(VS.80).aspx

cmsjr
I actually spent quite a bit of time going down that path as well prior to posting the question. Both QA and Dev both recognize the browser properly, as seen through Response.Browser object. Tried browscap entries in web.config and updated the browsercap.ini file (though its not asp.net specific).
TimGiorgi
+2  A: 

Check your web.config for xhtmlconformance and make sure it is not set to legacy.

http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx

Serge Melis