Jump to content

Check / Uncheck All


Darkness Soul

Recommended Posts

Yo guys,

Well, new problem.. how I need to do to make a check all option?

My form is like a security form..
each cheackbox have an unique name.. like "read_a" and "write_h"..

[code]module A [_]read [_]write
module B [_]read [_]write
module C [_]read [_]write
(...)
module V [_]read [_]write
module X [_]read [_]write
module Z [_]read [_]write

All Mods [_]read [_]write[/code]
"simple" like that..

^~ Thank you so much for any help..

Soul
Link to comment
https://forums.phpfreaks.com/topic/5433-check-uncheck-all/
Share on other sites

[!--quoteo(post=357050:date=Mar 21 2006, 07:10 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 21 2006, 07:10 PM) [snapback]357050[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Check All boxes are usually controlled via Javascript.

Ken
[/quote]

yep, this belongs in the javascript forum, but this is a little function that does what youre after. just use something like: onClick='check(document.form1.myfield)' whereas myfield is the name and id of all of your checkboxes:

[code]
var checkflag = "false";
function check(field) {
   if (checkflag == "false") {
      for (i = 0; i < field.length; i++) {
         field[i].checked = true;
      }
      checkflag = "true";
   }
   else {
      for (i = 0; i < field.length; i++) {
         field[i].checked = false;
      }
      checkflag = "false";
   }
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/5433-check-uncheck-all/#findComment-19427
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.