By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

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

100+
P: 365
How can I disable checkbox when it is selected Kernel?.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  3. <tr><td align="right" width="40%" valign="top" class="text1">Facility:</td>
  4. <td width="60%" valign="top" class="text1">
  5. <select name="logConfig.facility" size="1" class="txtbox" id="selFacility">
  6. <option $| web.dropdownSelected(configRow["logConfig.facility"] == "Kernel") |$ value="Kernel">Kernel</option>
  7. <option $| web.dropdownSelected(configRow["logConfig.facility"] == "System") |$ value="System">System</option>
  8. </select>
  9. <input type="submit" value="Apply" class="button1" title="Apply" name="button.choose.logConfig.logs"></td>
  10. </tr>
  11. <tr><td width="100%" valign="top" colspan="2">
  12. <table border="0" cellpadding="0" cellspacing="0" width="100%" class="text1">
  13. <tr>
  14. <td width="12%" align="center">&nbsp;</td>
  15. <td width="20%" align="center">Display in event Log</td>
  16. <td width="18%" align="center">Send to syslog</td>
  17. </tr>
  18. <tr>
  19. <td width="12%" align="right">Debugging:</td>
  20. <td width="20%" align="center"><input type="checkbox" name="logConfig.debug1" $| web.checkboxSelected(debugChoices[1] == 1) |$ value="1">
  21. <input type="hidden" name="logConfig.debug1" value="0"></td>
  22. <td width="18%" align="center"><input type="checkbox" name="logConfig.debug3" $| web.checkboxSelected(debugChoices[3] == 1) |$ value="1">
  23. <input type="hidden" name="logConfig.debug3" value="0"></td>
  24.  
  25.  
  26. </tr>
  27. </table></td></tr>
  28. </table>
  29.  
  30.  
Feb 4 '10 #1
Share this Question
Share on Google+
2 Replies


Atli
Expert 5K+
P: 5,058
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:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function sel_facility_change(newValue) {
  3.     // Make sure the new value is text.
  4.     if(typeof newValue == "string") {
  5.         // Fetch the checkbox. You need to
  6.         // fill in the actual ID of the checkbox you
  7.         // want to use.
  8.         var checkbox = document.getElementById('id-of-the-checkbox');
  9.  
  10.         // Disable / enable the checkbox based on the
  11.         // new value. (Note, any value for "disabled"
  12.         //  will disable it, even TRUE or 'enabled'.)
  13.         if(newValue == 'Kernel') {
  14.             checkbox.setAttribute('disabled', true);
  15.         }
  16.         else {
  17.             checkbox.removeAttribute('disabled');
  18.         }
  19.     }
  20. }
  21. </script>
And link that to the change even of your <select> by setting the onchange attribute in the HTML.
Expand|Select|Wrap|Line Numbers
  1. <select ... onchange="sel_facility_change(this.value);">
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?
Feb 4 '10 #2

100+
P: 365
Sorry for late, I apologize. Actually here lua script embedded in html.
Feb 9 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.