Posts Tagged ‘Firefox’


Client-side validation in Firefox

September 9, 2010

If you have
<xhtmlConformance mode=”Legacy“/>
set in your web.config, then client-side validation is disabled in firefox.

There is a Javascript expando attribute, defined on the DOM via Javascript, and therefore compatible with both IE and Firefox.

For example, the RequiredFieldValidator calls RegisterExpandoAttribute. You can call this method yourself like:

Page.ClientScript.RegisterExpandoAttribute(TextBox1.ClientID, “value”, TextBox1.Text);

 This produces a block of Javascript just before the closing </form> tag like:

¬†<script type=”text/javascript”>
var TextBox1 = document.all ? document.all[“TextBox1”] : document.getElementById(“TextBox1”);
TextBox1.value = “”;
// –>

But, if xhtmlConformance mode is Legacy that javascript code will not produces. you know document.all is only work with IE.

Just comment xhtmlConformance tag to solve this problem.