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

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

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,795
    Chris Barrow
    Nov 7, 2003
  2. Matt
    Replies:
    14
    Views:
    4,536
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  3. =?Utf-8?B?ZGh1cndpdHo=?=
    Replies:
    1
    Views:
    633
    Teemu Keiski
    Apr 10, 2004
  4. Roh
    Replies:
    2
    Views:
    459
    =?Utf-8?B?S29zdGFkaW4gS29zdG92?=
    Feb 2, 2005
  5. baroque Chou
    Replies:
    4
    Views:
    554
    Peter Blum
    Jan 24, 2006
  6. JP2006
    Replies:
    0
    Views:
    468
    JP2006
    Aug 22, 2006
  7. Peter Afonin

    Using Javascript and Validation controls

    Peter Afonin, Mar 14, 2007, in forum: ASP .Net
    Replies:
    6
    Views:
    478
    Peter Afonin
    Mar 20, 2007
  8. Peter Afonin

    Using Javascript and Validation controls

    Peter Afonin, Mar 14, 2007, in forum: ASP .Net Web Controls
    Replies:
    6
    Views:
    241
    Peter Afonin
    Mar 20, 2007
Loading...