471,852 Members | 1,239 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,852 software developers and data experts.

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
Oct 16 '08 #1
3 4763
acoder
16,027 Expert Mod 8TB
By option button, do you mean a checkbox? Post your code.
Oct 16 '08 #2
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
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.

Similar topics

1 post views Thread by hortoristic | last post: by
2 posts views Thread by SamSpade | last post: by
3 posts views Thread by Ajay Krishnan Thampi | last post: by
7 posts views Thread by Phil | last post: by
2 posts views Thread by Kevin | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.