You are not Logged in
Would you like to Login or Register

Today is: 05 February 2012
Check this months hot topics

ASP.NET Framework 1.1 Validation not working in IE7?

I recently had a problem with an old Framework 1.1 website where the form would not post back if the page contained validators (CustomValidators to be exact). It caused me to do a lot of googling and in the end some javascript debugging.

It was a strange problem, the site worked fine in IE6 and Firefox; just IE7 failed. Searching the web I was suppried that nobody else was complaining about this.. surely it was a 1.1 IE7 bug??

First clue

onsubmit="if (!ValidatorOnSubmit()) return false;"

In the onSubmit attribute of the form tag there is a call to ValidatorOnSubmit(). When Alerting this in JavaScript it returned "Undefined"

I checked that the scriptmaps were ok and even reinstalled them using ASPNET_REGIIS -s <path>. Still no dice.

The solution

It turned out that .net Framework 1.1 SP1 had been installed on the server but this site had local copies of the pre SP1 WebUIValidation.js file.

I replaced the files with the correct ones and things started to work... sort of..

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ASP.NETClientFiles

Problems with pre SP1 code and the CustomValidator control

The validation now triggered. Slight problem, it always failed, without even doing the postback it needed to perform server-side validation.

The solution was to add a dummy custom validator function to allow client validation to pass client-side checks before doing server-side validation.

<script>
     function customvalidatorDummy(source,args){
        args.IsValid=true;
     }
</script>

<ASP:CUSTOMVALIDATOR ClientValidationFunction="customvalidatorDummy" ... />
kick it on DotNetKicks.com del.icio.us digg Mister Wong YahooMyWeb Reddit Furl Spurl blogmarks
Paul Hayman Skype
Author : Paul Hayman
Published : 04 July 2007

Paul is the COO of kwiboo ltd consultant and has more than a decade of IT consultancy experience. He has consulted for a number of blue chip companies and has been exposed to the folowing sectors: Utilities, Telecommunications, Insurance, Media, Investment Banking, Leisure, Legal, CRM, Pharmaceuticals, Interactive Gaming, Mobile Communications, Online Services. Paul is the COO and co-founder of kwiboo (http://www.kwiboo.com/) and is also the creator of GeekZilla.

Add Comment

Enter your comment below and it will be submitted for moderation.

Your Name

Add Tag

Please enter tags for this article, seperated by semi-colon ;

View Tag's by : # articles | # views

More Publications

Select a row in an asp:GridView without using a Select Command
Paul Marshall - 14/06/2006
"This row already belongs to another table" Error
Paul Marshall - 24/10/2006
Authenticated HTTPRequests (Using Credentials)
Dave Howard - 04/09/2006
Creating a Tag Cloud in C#
Paul Hayman - 22/08/2006
Google Applicance - googleoff / googleon Tags
Paul Hayman - 27/09/2006