I need to disable checkbox when top dropdown box selected as kernel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tvnaidu
    Contributor
    • Oct 2009
    • 365

    I need to disable checkbox when top dropdown box selected as kernel

    How can I disable checkbox when it is selected Kernel?.

    Code:
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr><td align="right" width="40%" valign="top" class="text1">Facility:</td>
    <td width="60%" valign="top" class="text1">
    <select name="logConfig.facility" size="1" class="txtbox" id="selFacility">
    <option $| web.dropdownSelected(configRow["logConfig.facility"] == "Kernel") |$ value="Kernel">Kernel</option>
    <option $| web.dropdownSelected(configRow["logConfig.facility"] == "System") |$ value="System">System</option>
    </select>
    <input type="submit" value="Apply" class="button1" title="Apply" name="button.choose.logConfig.logs"></td>
    </tr>
    <tr><td width="100%" valign="top" colspan="2">
    <table border="0" cellpadding="0" cellspacing="0" width="100%" class="text1">
    <tr>
    <td width="12%" align="center">&nbsp;</td>
    <td width="20%" align="center">Display in event Log</td>
    <td width="18%" align="center">Send to syslog</td>
    </tr>
    <tr>
    <td width="12%" align="right">Debugging:</td>
    <td width="20%" align="center"><input type="checkbox" name="logConfig.debug1" $| web.checkboxSelected(debugChoices[1] == 1) |$ value="1">
    <input type="hidden" name="logConfig.debug1" value="0"></td>
    <td width="18%" align="center"><input type="checkbox" name="logConfig.debug3" $| web.checkboxSelected(debugChoices[3] == 1) |$ value="1">
    <input type="hidden" name="logConfig.debug3" value="0"></td>
    
    
    </tr>
    </table></td></tr>
    </table>
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    You would need to either use JavaScript (the easy way) or some sort of server-side scripting (the hard way).

    Using JavaScript, you could add something like this to your <head> section:
    [code=javascript]<script type="text/javascript">
    function sel_facility_ch ange(newValue) {
    // Make sure the new value is text.
    if(typeof newValue == "string") {
    // Fetch the checkbox. You need to
    // fill in the actual ID of the checkbox you
    // want to use.
    var checkbox = document.getEle mentById('id-of-the-checkbox');

    // Disable / enable the checkbox based on the
    // new value. (Note, any value for "disabled"
    // will disable it, even TRUE or 'enabled'.)
    if(newValue == 'Kernel') {
    checkbox.setAtt ribute('disable d', true);
    }
    else {
    checkbox.remove Attribute('disa bled');
    }
    }
    }
    </script>[/code]

    And link that to the change even of your <select> by setting the onchange attribute in the HTML.
    [code=html]<select ... onchange="sel_f acility_change( this.value);">[/code]

    Now, when you change the selection of the drop-down, the change event fires and the JavaScript function is executed.

    P.S.
    What is the $| ... |$ syntax in your HTML?

    Comment

    • tvnaidu
      Contributor
      • Oct 2009
      • 365

      #3
      Sorry for late, I apologize. Actually here lua script embedded in html.

      Comment

      Working...