File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

select and unselecting checkboxes based on clicking a check box

 
shyamkumar bopannachengalaiah
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a check box name "select" and and also some four check boxes named as "child". when i click or check the "select" check box all the child check box has to be checked and when i unselect or uncheck the "select" box ,all the child check boxes has to be unchecked. I have done this task using javascript. My problem is that when i uncheck atleast a "child" checkbox automatically the "select" check box has to be unselected. How can i do this using javascript?If there is any example available kindly publish here.
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when click of select checkbox you calling JS function in that you are checking all child checkboxes I guess.

same way when you click on any child checkbox call another JS function in that get all child checkbox & check if any one of them is unchecked then uncheck select checkbox.

 
Romit Bose
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
how about writing one generic function which handles all the checkboxes? say you have a javascript method called
handleCheckBoxes(key) and you pass "this", that is, the reference to that box on whose selection you are calling the method.
Now, inside the method, its simply writing the conditions and selecting or unselecting the boxes, right?
 
shyamkumar bopannachengalaiah
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shail Narkhede wrote:when click of select checkbox you calling JS function in that you are checking all child checkboxes I guess.

same way when you click on any child checkbox call another JS function in that get all child checkbox & check if any one of them is unchecked then uncheck select checkbox.



Is there any examples available?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic