This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes How to disable form using checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to disable form using checkbox" Watch "How to disable form using checkbox" New topic
Author

How to disable form using checkbox

smitha mulu
Greenhorn

Joined: Aug 18, 2009
Posts: 6
Hi

we are using struts in our application

I have check box in one page after selecting that check box the below form should be disabled. if i don't select the form should be enabled.I implemented below code. but it is not working


<style>
.offstate-displayaddress{
display: none ;
}
.onstate-displayaddress{
display: block;
}
</style>

<div>
<html:checkbox property="address.unknownI" value="Y" styleClass="switch-displayaddress">
<label >Unknown Address</label>
</div>

<span class="onstate-displayaddress">

//all form related code

</span>

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Is that some sort of new CSS that will automatically toggle between CSS styles based on a checkbox selection? I haven't seen it before, but I'm not much of a CSS person.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60769
    
  65

There is no CSS capability to automatically switch anything. You'll need JavaScript.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I bet that's why it doesn't work.
 
Don't get me started about those stupid light bulbs.
 
subject: How to disable form using checkbox
 
Similar Threads
jsp
jQuery select option
Handling validations of multiple forms in single jsp
Help ASAP!
ui:decorate