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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.