Dynamically enable/disable controls on dropdown selectedindex change

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abehm
    New Member
    • May 2007
    • 35

    Dynamically enable/disable controls on dropdown selectedindex change

    Hey all,
    I'm trying to disable a couple controls if a user clicks on a certain item in a dropdown list. I can do it on postback, but if someone could help me to do it dynamically, that would be key! Thanks in advance!
    Aaron
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by abehm
    Hey all,
    I'm trying to disable a couple controls if a user clicks on a certain item in a dropdown list. I can do it on postback, but if someone could help me to do it dynamically, that would be key! Thanks in advance!
    Aaron
    Call a Javascript function onChange of the dropdown and you're done! The function that you call will simply disable the items based on the value selected in the drop down.

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Merged duplicate threads.

      Comment

      • abehm
        New Member
        • May 2007
        • 35

        #4
        yeah, i understand that's what I have to do. I just don't know if this function will work:
        [CODE="asp"]

        function IsSelected()
        {
        if ((cboParameters .SelectedItem.T ext == "All Passed Tests") || (cboParameters. SelectedItem.Te xt == "All Failed Tests")
        || (cboParameters. SelectedItem.Te xt == "All Incomplete Tests") || (cboParameters. SelectedItem.Te xt == "All Complete Tests"))
        {
        cboOperators.Vi sible = false;
        txtComparisonVa lue.Visible = false;
        lblMessage.Text = "";
        }
        else
        {
        cboOperators.Vi sible = true;
        txtComparisonVa lue.Visible = true;
        }
        }
        [/CODE]

        also, this is in an asp page, not html.

        Comment

        Working...