aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes checkbox activated deactivated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "checkbox activated deactivated" Watch "checkbox activated deactivated" New topic
Author

checkbox activated deactivated

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 321
Hi

I am retrieving from my servlet always true using the code



My html code is



But i want retrieve true only if the checkbox is pressed. Any idea?

Thanks
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

You are using the wrong attribute. Use checked="checked" in your markup to make it checked when the page is loaded. The value attribute is used to differentiate the checkbox from other checkboxes in the same group (that is, a group of checkboxes would have the same 'name' attribute but each checkbox would have a unique 'value' to differentiate it from others)



Junilu - [How to Ask Questions] [How to Answer Questions]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60072
    
  65

The value of the checkbox will only be submitted when it is checked. If unchecked, no value will be submitted.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: checkbox activated deactivated
 
Similar Threads
multiple javascript functions are not working properly
how to insert multiple check box values into the database using single parameter
Display a Form on a button click using struts tags
request.setAttribute() and request.getAttribute()
Getting the TD value using JavaScript + TD does not contain any ID.