aspose file tools*
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 Spring in Action this week in the Spring 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: 61433
    
  67

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