Entry
How can i get an array thet contains all checkboxes in document and submit them only if checked
Sep 24th, 2003 19:13
Eugene Loh, Bart G., Marja Delfos, selene rebane, marja.delfos@wxs.nl
With just this
<input type="CHECKBOX" name="name">
in my document
it submits only if"name" is checked.
bg -
All of the check boxes should have the same name:
<input type="checkbox" name="a" value="va">
<input type="checkbox" name="a" value="vb">
<input type="checkbox" name="a" value="vc">
<input type="checkbox" name="a" value="vd">
When the form is submitted it will send 'a' as 'va,vb,vc,vd', given
that all checkboxes were checked. If checkbox 1 and checkbox 2 were
checked, then 'a' will be 'va,vb'. Unchecked boxes are ignored.
Sorry, First post here, don't know how this site work yet.
Was looking for help or doing this getting the checkboxes value over to
the next page without using submit form, but couldn't find any, so i
tired on my own using javascript, here's my code:
function checkedBoxes(e)
{
var sizeOfBoxes = e.length;
var checkedValue = new String();
for (var i = 0;i < sizeOfBoxes; i++)
{
if (e[i].checked == true)
{
checkedValue += e[i].value + ',';
}
}
return checkedValue
}
Then this is the link:
<a href="javascript:self.location='4th_upd_pe_BatchUpdate.asp?
midBoxes='+checkedBoxes(document.updDelPETable.midBoxes);">Update</a>
But does anyone know how to get rid of the last ',' ??, cause me still
new to javascript.
Btw, that is the webby that I'm currently busy with.