Jump to content

Archived

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

Darkness Soul

Check / Uncheck All

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

Share this post


Link to post
Share on other sites
Check All boxes are usually controlled via Javascript.

Ken

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

×

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.