• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to disable form using checkbox

 
smitha mulu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no CSS capability to automatically switch anything. You'll need JavaScript.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I bet that's why it doesn't work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic