Enable and Disable Drop down control with option button/checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thirish
    New Member
    • Oct 2008
    • 4

    Enable and Disable Drop down control with option button/checkbox

    Hi,

    I have jsp page, on jsp page, The data is displaying from xml island. the Requriement is i have optional button and dropdown in each row. if user check the option button in second row then second row dropdown should be enable. if uncheck then dropdown should be disable. Any body help in this case. In jsp page i will get more than two row. let me know if any more requriments.

    Thanks,
    Tirish
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    By option button, do you mean a checkbox? Post your code.

    Comment

    • thirish
      New Member
      • Oct 2008
      • 4

      #3
      Enable and Disable Drop down control with Check box

      Hi,

      I have jsp page, on jsp page, The data is displaying from xml island. the Requriement is i have Check box and dropdown in each row. if user check the option button in second row then second row dropdown should be enable. if uncheck then dropdown should be disable. Any body help in this case. In jsp page i will get more than two row. let me know if any more requriments.

      Thanks,
      Tirish

      Comment

      • zaphod42
        New Member
        • Oct 2008
        • 55

        #4
        select boxes have a property called "disabled".

        Depending on how you grab the element let's say:

        Code:
        toggleSelect=function(el){
        var numb=el.id.substring(7)
        if(document.all){document.all['select'+numb].disabled=el.checked?false:true}
        else{document.getElementByID('select'+numb).disabled=el.checked?false:true}
        }
        [HTML]<select id="select2">
        <option />
        option
        blah blah blah
        </select>
        <input type="checkbox" id="checkbox2" onClick="toggle Select(this)" />[/HTML]

        notice in the html, the id's share a number....easy to cross reference the fields, then I check the checkbox's state (whether or not it's checked) to ensure we're taking the right action

        Comment

        Working...