Validation Controls and Javascript

  • Thread starter Thread starter Jennifer Mathews
  • Start date Start date
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
 
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

Back
Top