QuickForm - advcheckbox and check_all
| From: | Mos | Date: | Fri, 05 Nov 2004 14:48:49 +0000 |
| Subject: | QuickForm - advcheckbox and check_all | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-15351@lists.php.net to get a copy of this message | ||
Hi everybody !
I created a Form with Quick Form and now I would be glad to set a link which
enables to check all the advcheckbox I set.
I try with javascript but it doesn't works... I have no idea how to do that
through PHP (I use PEAR::Pager inside my Form too).
Here is the code I use to set up the form :
$form->addElement('link',
'select_all',
'',
'',
'<img src="./check.png" border=0 alt="Select All"
title="Select All">',
array ('onclick' => "javascript:check_all(this.form);")
);
Here is the javascript I pu in the HEAD section :
<script type="text/javascript">
function check_all(dataForm)
{
for (i=0; i < dataForm.elements.length; i++)
{
if (dataForm.elements[i].type == 'checkbox')
{
dataForm.elements[i].checked = true;
}
}
}
</script>
Is anybody have a suggestion to perform such a feature ?(I would be glad to
use PPHP and PEAR classes, but all I try does't work too...
Best regards
Mos