Validation Controls and Javascript

Discussion in 'ASP .Net' started by Jennifer Mathews, Sep 12, 2009.

  1. 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
     
    Jennifer Mathews, Sep 12, 2009
    #1
    1. Advertising

  2. 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.


    "Jennifer Mathews" <> wrote in message
    news:...
    >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
    >
     
    Jennifer Mathews, Sep 12, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Barrow
    Replies:
    2
    Views:
    5,570
    Chris Barrow
    Nov 7, 2003
  2. Matt
    Replies:
    14
    Views:
    4,110
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  3. =?Utf-8?B?ZGh1cndpdHo=?=
    Replies:
    1
    Views:
    463
    Teemu Keiski
    Apr 10, 2004
  4. baroque Chou
    Replies:
    4
    Views:
    435
    Peter Blum
    Jan 24, 2006
  5. Grigory Temchenko
    Replies:
    0
    Views:
    332
    Grigory Temchenko
    Dec 28, 2008
Loading...

Share This Page