• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with unchecking checkbox

 
raja reddy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I am trying to checkbox using checked="yes" ,checked="true".Its working.
But I am unchecking using checked="no" ,checked="false" ,the checkbox is not unchecking.

can anybody help?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you setting it in the html code or with JavaScript?

When is it not unchecking?

Eric
 
raja reddy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using checkbox in HTML
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To make it unchecked, you do not have to specify anything. The default is unchecked.

If it is happening on page refresh, you would have to code some JavaScript to reset the checkboxes on the page load.

Eric
 
raja reddy
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using checkbox in HTML.When I am unchecking checkbox in html using

its not unchecking.

what are the values i can use for checking and unchecking checkbox.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here it is one more time: if the checked attribute appears, the checkbox will be checked. It doesn't matter what you set the value to.
[ November 14, 2008: Message edited by: Bear Bibeault ]
 
Paul Yule
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact you don't even need a value for the "checked" attribute.

<input type="checkBox" checked/>

works just fine. If it isn't checked it will be sent as null so you can just check if the parameter is null. In my experience the value attribute for a checkBox--more often that not-- is superfluous. If other data is needed to be sent with the specific checkBox you bind a js function to the onClick of the checkBox and pass the HTML object to the function.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic