Jump to content


Photo

Check / Uncheck All


  • Please log in to reply
2 replies to this topic

#1 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 21 March 2006 - 05:57 PM

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"..

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
"simple" like that..

^~ Thank you so much for any help..

Soul
(If something is wrong, please tell me. I'm learning this language. Thank you)

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 21 March 2006 - 07:10 PM

Check All boxes are usually controlled via Javascript.

Ken

#3 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 21 March 2006 - 07:28 PM

[!--quoteo(post=357050:date=Mar 21 2006, 07:10 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Mar 21 2006, 07:10 PM) View Post[/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:

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";
   }
}

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users