ValidatorEnable doesn't?

G

Guest

Hi,

I have a couple websites that use the

ValidatorEnable(CompareValidator1, false)

to disable the validator from firing on testing some conditions in js.

My latest site is using masterpages so getting the control name is a little
more complex since it gets it's name mangled. None the less - I can get the
control name using something like this:

ValidatorEnable({0}, false);

where {0} is defined as CompareValidator1.ClientID.

When I look at the script that is generated either with viewsource or using
the IDE script debugging - it gets assembled correctly:

ValidatorEnable(ctl00_ContentPlaceHolder1_CompareValidator1, false);

The problem is that the Validator is not being disabled. Has anyone seen or
heard of a problem like this with ValidatorEnable function? I'm about a week
behind on my delivery of this release so any advice would be greatly
appreciated.

thanks!!
Bill
 
G

Guest

The problem with your code is that you are passing the ClientID (instead of
the object referred to by the clientID) to the ValidatorEnable function. Try
this instead:
ValidatorEnable(document.getElementById("ctl00_ContentPlaceHolder1_CompareValidator1"), false);

or if you know the order of the validators on your page then your can refer
to the valdiator by its ordinal number within the Page_Validators array, e.g.
ValidatorValidate(Page_Validators[0],false);
 
G

Guest

Thanks Phillip for the quick reply.. as soon as I read your email I thought
that this was probably the problem solution. I made the changes and I had the
same problem with the Validators. As it turns out, I found a different
solution to the problem (isn't that just often the case :).

Thanks Much!!

Phillip Williams said:
The problem with your code is that you are passing the ClientID (instead of
the object referred to by the clientID) to the ValidatorEnable function. Try
this instead:
ValidatorEnable(document.getElementById("ctl00_ContentPlaceHolder1_CompareValidator1"), false);

or if you know the order of the validators on your page then your can refer
to the valdiator by its ordinal number within the Page_Validators array, e.g.
ValidatorValidate(Page_Validators[0],false);
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


Bill44077 said:
Hi,

I have a couple websites that use the

ValidatorEnable(CompareValidator1, false)

to disable the validator from firing on testing some conditions in js.

My latest site is using masterpages so getting the control name is a little
more complex since it gets it's name mangled. None the less - I can get the
control name using something like this:

ValidatorEnable({0}, false);

where {0} is defined as CompareValidator1.ClientID.

When I look at the script that is generated either with viewsource or using
the IDE script debugging - it gets assembled correctly:

ValidatorEnable(ctl00_ContentPlaceHolder1_CompareValidator1, false);

The problem is that the Validator is not being disabled. Has anyone seen or
heard of a problem like this with ValidatorEnable function? I'm about a week
behind on my delivery of this release so any advice would be greatly
appreciated.

thanks!!
Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top