This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Enable and Disable html:select  - On selecting and deselecting  html:checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Enable and Disable html:select  - On selecting and deselecting  html:checkbox" Watch "Enable and Disable html:select  - On selecting and deselecting  html:checkbox" New topic
Author

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

Paulina Tanner
Greenhorn

Joined: May 10, 2008
Posts: 3
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

Joined: Dec 11, 2004
Posts: 13410

"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 ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Paulina Tanner
Greenhorn

Joined: May 10, 2008
Posts: 3
Thanks Ben for pointing out. I have changed the display name.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
rahul jadeja
Greenhorn

Joined: Oct 15, 2009
Posts: 11
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enable and Disable html:select - On selecting and deselecting html:checkbox
 
Similar Threads
How to disable html:checkbox based on html:radio selection
how to validate
html:options horrible default settings
html:select disabled property not working
disabling html:select and html:text by the value in another html:select