468,272 Members | 2,016 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

Enable/Disable RequiredFieldValidator

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/de...pplusvalid.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.
--

Alphonse Giambrone
Email: a-giam at customdatasolutions dot us

Jul 21 '05 #1
3 15663
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.)

Jul 21 '05 #2
Hi Luke, thanks for the quick response.

Since strFocus is a variable, I thought it should not have quotes around it
so I tried:
strFocus="valrUserLoginF";
ValidatorEnable(document.all(strFocus), true);

With that the error is now:
"null" is null or not an object.

So I put the quotes around strFocus per your suggestion and still get the
same error.

What am I doing wrong?

--

Alphonse Giambrone
Email: a-giam at customdatasolutions dot us
"MSFT" <lu******@online.microsoft.com> wrote in message
news:K%****************@cpmsftngxa07.phx.gbl...
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.)

Jul 21 '05 #3
Luke,

This works using the ClientID of the validator.

Thanks for your help!

--

Alphonse Giambrone
Email: a-giam at customdatasolutions dot us
"MSFT" <lu******@online.microsoft.com> wrote in message
news:K%****************@cpmsftngxa07.phx.gbl...
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.)

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Alphonse Giambrone | last post: by
5 posts views Thread by dhnriverside | last post: by
reply views Thread by talal | last post: by
8 posts views Thread by rongchaua | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.