Hi Guys,
How can I have a "Select all" button and have a tick box array?
I need suggestions please.
I create the array by naming all the tick boxes "name[]" and pass to the array by posting the form . This works fine.
BUT
I have some Javascript which ticks all the boxes. That workes fine too. But only if the tick box does not have the square brackets at the end. So I cannot create an array if I want this "check all" functionality.
Here is the code
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < filed.length; i++) {
field.checked = true;}
checkflag = "true";
return "Deselect All"; }
else {
for (i = 0; i < field.length; i++) {
field.checked = false; }
checkflag = "false";
return "Select All"; }
}
// End -->
Any suggestions please???
Thanks
Best regards
RichFM