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

Enable and Disable Drop down control with option button/checkbox

P: 4
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
Oct 16 '08 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
By option button, do you mean a checkbox? Post your code.
Oct 16 '08 #2

P: 4
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
Oct 20 '08 #3

P: 55
select boxes have a property called "disabled".

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

Expand|Select|Wrap|Line Numbers
  1. toggleSelect=function(el){
  2. var numb=el.id.substring(7)
  3. if(document.all){document.all['select'+numb].disabled=el.checked?false:true}
  4. else{document.getElementByID('select'+numb).disabled=el.checked?false:true}
  5. }
[HTML]<select id="select2">
<option />
option
blah blah blah
</select>
<input type="checkbox" id="checkbox2" onClick="toggleSelect(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
Oct 20 '08 #4

Post your reply

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