-----Original Message-----
From: Mike Jasnowski [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 14, 2003 2:57 PM
To: Goldy J
Cc: [EMAIL PROTECTED]
Subject: RE: Checkall for Multibox--pls. help

Hello,
 
 Attached is a JSP that illustrates the checkbox interaction you describe in the context of a <html:multibox> use. I adapted it from my use in a custom tag I had, so the logic to check the top-most checkbox is hardwired.  In my usages, this checkbox is only checked if all existing checkboxes in the table are checked. This is generally done by comparing whether items from one collection appear in another. So you might need to adapt it a bit more to your case. But the interactions are as follows:
 
1) When unchecking the top-most checkbox (this appears in the table heading), all other checkboxes in the table are unchecked, and vice-versa when checked
2) When unchecking the first checkbox in a row, the top-most checkbox is unchecked.
3) When checking the last checkbox in a set of rows, the top-most checkbox is checked.
 
You'll need to change the property names etc. and checkbox names to match your environment/application.
 
HTH,
Mike Jasnowski
-----Original Message-----
From: Goldy J [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 14, 2003 4:42 AM
To: [EMAIL PROTECTED]
Subject: RE: Checkall for Multibox--pls. help

Hello Mike,
 
I tried using code in my JSP but it didnt work. I am attaching the code snippet of the same.
Basically as I mentioned earlier I am using multibox inside a iterator tag to show checkboxes for valid rows of a table. And there is a checkbox at the top which should check and uncheck them all.
 
The first part of my attached code is the universal checkbox , whereas the lower is the multibox checkboxes for every row.
 
If you could provide some inputs it would be helpful . Also if u could send the JSP of ur code it would help how to use it .
 
Thanks

Mike Jasnowski <[EMAIL PROTECTED]> wrote:
Yes it is possible, I'm not using multibox, but the same logic applies:

function checkAll(cAll){
var cbs = document.forms[0].elements['" + checkBoxNamePrefix + "'];
if (typeof cbs.length == \"undefined\") {
cbs = document.forms[0]." + checkBoxNamePrefix + ";
if (cAll.checked " + andOps + " !cbs.checked) cbs.checked = true; if
(!cAll.checked && cbs.checked) cbs.checked = false;
return;
}
for (var i=0;i if (cbs[i].checked && !cAll.checked) cbs[i].checked = false;
else (cbs[i].checked) = true;");
}

function unCheck(item){");
if (!item.checked) document.forms[0].all.checked = false;
else {
var cbs = document.forms[0].elements['" + checkBoxNamePrefix +
"'];
for (var i=0;i if (!cbs[i].checked) return false;
}
document.forms[0].all.checked = true;
}

if! the formatting is off I apologize, I cut this out of some code and
reformatted for email. The checkAll function is for the top-level box, and
the unCheck() item is for an individual item. The variable part is the
"checkboxNameprefix" which is supplied when the tag this comes from renders
the set of checkboxes. If you need more info let me know.

-----Original Message-----
From: Goldy J [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 12:49 PM
To: [EMAIL PROTECTED]
Subject: Checkall for Multibox--pls. help


Hello,

I have a JSP in which I show number of records in a table. Each row has a
checkbox associated with it. All the valid records has to be checked by
default. I have been able to do so using MULTIBOX using TED's famous tip.

My problem is that the client wants a checkbox at the top , click of which
should select all the checkbox and unselect of which should unselect all in
one go ..s! omething similar to yahoo mail ..

Tried to do some stuff but failed. Can some one help and let me know if it
is at all possible to do so with multibox ..if yes how??

Thanks in advance


---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to