I have a bunch of checkboxes that are generated according to the amount of results read from the DB..
Like this:
<input type="checkbox" name="deleteMe[]" value="107" class="chckbox">
<input type="checkbox" name="deleteMe[]" value="108" class="chckbox">
<input type="checkbox" name="deleteMe[]" value="109" class="chckbox">
As you can see that the checkboxes are stored by the same name "deleteMe[]" as an array. The value corresponds to the "id" of the particular row in question, to be deleted.
I have written a javascript function that goes into the "Select All" button. The button lets the user make Javascript select all the checkboxes...cz otherwise if there were a 100 checkboxes the user would have to check of each one of them....GEEEZ ok anyway here is the problem. This is the javascript function i have, called selectAll()
function selectAll()
{
len = document.FormName.deleteMe.length;
var i=0;
for (i=0; i<len; i++)
{
document.FormName.deleteMe.checked = true;
}
}
You see that function worked perfectly before because i didn't use "deleteMe[]" as the checkbox name, I was using "deleteMe" without the square brackets. So now if i add in the "[]" to the checkbox name: like this....
function selectAll()
{
len = document.FormName.deleteMe[].length;
var i=0;
for (i=0; i<len; i++)
{
document.FormName.deleteMe[].checked = true;
}
}
It dont work anymore....
The only thing i can think of is to find a way to keep the checkbox names as "deleteMe" and still get the values for all of them that the user selects. But i dont think the checkboxe's values will register as an array unless i have the square brackets at the end of the name. Damn im stuck.....