Validation Controls and Javascript

J

Jennifer Mathews

I there anyway to disable a validation control from JavaScript?

In Code-Behind, it is easily done with:
myValidationControl.Enabled = false;

Is there anyway to do this from JavaScript?

Thanks
 
J

Jennifer Mathews

Found an answer.

Initially, the answer seemed so so simple with someone's blog out on the web:

ValidatorEnable(document.getElementById("txtCmp_Item_Name"), false);
with "txtCmp_Item_Name" being the ID of the field being validated.

The problem with this was that when the field's validator was diabled,
the textbox that it was validating was hidden. (I suppose something like .visible =
false).
But I still wanted the textbox to be visible.

Another suggestion that worked was to disable the validator by the validator's ID:

document.getElementById("rev_txtCmp_Item_Name").disabled = true;
with "rev_txtCmp_Item_Name" being the ID of the validator.

Apprently the creative people of Microsoft tied the validator controls
to a .disabled property.
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top