This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enable and Disable html:select - On selecting and deselecting html:checkbox

 
Paulina Tanner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

my struts form has a <html:checkbox> and <html:select>. All I want to do is to

1. Keep the <html:select> disabled when the page loads
2. Enable the <html:select> when <html:checkbox> is selected
3. Disable the <html:select> when <html:checkbox> is de-selected.


Please help.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Caliber123",
Welcome to JavaRanch!

We're pleased to have you here with us here on the ranch, but there are a few rules that need to be followed. One is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Initials are OK for the first and middle names but not the last. You can change it here
[ May 14, 2008: Message edited by: Ben Souther ]
 
Paulina Tanner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben for pointing out. I have changed the display name.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you want to change the disabled status after the page has already been sent to the browser, you will need to use JavaScript to accomplish this. Just specify disabled="true" on your html:select tag. Then write a JavaScript function triggered by the onclick event of the html:checkbox tag. In the function you can check whether the status of the button is checked or unchecked and enable or disable the select control accordingly.
 
rahul jadeja
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Merrill, I know what you are trying to say but can you please tell me in which file should i write the java script code and can you help me out with that
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic