Skip to main content

Form validation in non IE browsers

Learnt a new thing today:-

Ever tried using Form Validators on a form which would be opened in a Non MS IE browser?
You will be surprised to see that the client side validation doesn't work even though you have set cleintvalidation to True.
Only the server side validation work for Non MS IE Browsers.

The reason for this is because of the way the validators are built up.

To start with,by default ASP.NET is configured to send HTML 4.0-compliant HTML to only Internet Explorer, and sends HTML 3.2-compliant HTML to all non-Microsoft browsers, even though modern, non-Microsoft browsers such as Netscape 6.0+, Mozilla, Opera etc. can handle HTML 4.0.
This can be taken care of by changing the configuration in the Browser Caps section of the config file.

But one thing that still creates a problem for client side validation is the way the client side script is renedered on to the page.
Using the Browser Caps settings the HTML 4.0 compliant HTML will be rendered onto the page but inspite of this the script emitted by the BaseValidator class contains a javascript block that creates an array of all the validators on that particular page.
This array is used to itterate through to check the validity of the controls on the page
its done using the


script which is only supported by Microsoft's Internet Explorer While other browsers (including MS IE) supports the standard way


There are some workarounds like some people who have build validator controls by extending from the Basevalidator class and overiding the method that emits the Javascript code to emit the correct standard script.

Good news is that this problem is taken care of in Whidbey (.NET 2.0)
Bad news is till its released we have to work with the workarounds :)


Popular posts from this blog

How to Install Hadoop (2.7.3) on Ubuntu (16.04 LTS)

As I am planning to learn Hadoop, I wanted to install Hadoop (2.7.3) on my Ubuntu (16.04 LTS) and I followed the steps mentioned in the documentation on the Apache Hadoop website. I encountered few problems which are mentioned below, spent some time finding solution to them.

Below are the steps I followed and the description of the error is at the end of this post and also I have mentioned what I missed and what caused these errors.

Step 1. Download Hadoop installation file. For Hadoop 2.7.3 version I used the following link 2. (Assuming you have downloaded the file into /home/<username>/Downloads folder

$ tar zxf hadoop-2.7.3-src.tar.gz
This will extract the files into a folder  "hadoop-2.7.3" .

Step 3. I moved the file to /home/<username> folder (many suggest to move it into /usr/local but I prefer to keep it here, may be once I learn more about linux I might get into tha…

Installing Adobe Reader on Ubuntu 16.04 LTS

Adobe stopped Adobe Reader support for Linux so it is bit of a challenge to find and install the Adobe Reader for Linux. Here I describe how to install it on Ubuntu 16.04 LTS.

Step 1. First install gdebi

sudo apt-get install gdebi
Step 2. Install required libraries

sudo apt-get install libgtk2.0-0:i386
sudo apt-get install libnss3-1d:i386
sudo apt-get install libnspr4-0d:i386
sudo apt-get install libxml2:i386
sudo apt-get install libxslt1.1:i386

Step 3. Download the Adobe Reader DEB package

Adobe Reader 9.5.5 enu

Javascript KeyCode Reference table for Event Handling

The post explains Keyboard event handling using javascript.Javascript events are used to capture user keystrokes. Below is a table of key codes for the keys on a multimedia keyboard. If this table is inconsistent with your own findings, please let me know.

Java Script Code to Find Key code

<script language="JavaScript">
document.onkeydown = checkKeycode
function checkKeycode(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
alert("keycode: " + keycode);

Key Code Reference Table
Key PressedJavascript Key Codebackspace8tab9enter13shift16ctrl17alt18pause/break19caps lock20escape27page up33page down34end35home36left arrow37up arrow38right arrow39down arrow40insert45delete46048149250351452553654755856957a65b66c67d68