Posts Tagged ‘Client-side validation’

h1

Ignore Validation For Hidden Controls

April 3, 2012

Ignore the validation for Hidden Controls just include This:

Javascript:

$(document).ready(function () {
$(‘#form1’).validate({ ignore: ‘:hidden’ });
});

h1

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 = “”;
// –>
</script>

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.