• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Select All

 
Ranch Hand
Posts: 243
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm trying to implement a select all functionality i.e if I select a checkbox, a set of other checkboxes must be checked.
The name of check boxes will be like chk1,chk2,chk3...chk22....



I need a pattern for chk.Can it be done?

Thanks all,
Srikkanth.M
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One solution would be to use eva l:



Note that "eva l" must be written as a single word, but the forum software won't allow it

Another solution would be to use a framework that will make it easier for you. For instance, using jQuery you can achieve this in just a few lines:



This code basically means:
when the checkbox with id checkAll is clicked, take all the other checkboxes whose name attribute starts with "chk" and set their "checked" attribute only if checkAll is checked (i.e., this refers to checkAll within the click event handler).
[ August 17, 2007: Message edited by: Valentin Crettaz ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
eval = EWWWWWWW! Forget that exits unless you are working with JSON!




another thing you can do is something like this



[I wrote the code here without testing]

Eric
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
eval = EWWWWWWW!

Wasn't very clever from me, I admit
TGIF !!
[ August 17, 2007: Message edited by: Valentin Crettaz ]
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic