Enable/Disable RequiredFieldValidator

  • Thread starter Thread starter Alphonse Giambrone
  • Start date Start date
A

Alphonse Giambrone

I am trying to enable/disable a requiredfieldvalidator on the client side
and am generating an error.
I had found some documentation on validation which states that I should be
able to enable/disable validators on the client side.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspplusvalid.asp

According to it and the little other info I was able to find, the way to
accomplish what I want it to call ValidatorEnable on the client side to
enable/disable the validator.
As a test, I disabled the validator as the default and I am calling a
javascript function on page load which contains the following code:

strFocus="valrUserLoginF";
ValidatorEnable(strFocus, true);

With this, I receive a runtime error: 'style' is null or not an object.
valrUserLoginF is the declared id of the validator. I have also tried using
the clientid for it and get the same result.

How can I get the ValidatorEnable function to work?

Thanks for any help.
 
Hi Alphonse,

We need to pass a object to ValidatorEnable, not a string. For example

ValidatorEnable(document.all("strFocus"), true);

hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top