Click to See Complete Forum and Search --> : how can i know if some checkboxes from a group were checked


sorinc
09-24-2003, 09:14 AM
Hello!

I have a group of checkboxes named "options", like this:
<INPUT type="checkbox" name="options" value=a />
<INPUT type="checkbox" name="options" value=b />
<INPUT type="checkbox" name="options" value=c />
<INPUT type="checkbox" name="options" value=d />
within a form named frm.
I want to verify if one or more of the checkboxes were checked in a function. I tried with:
document.frm.options.checked but it doesn't work.
How can i solve that?

Thanks

Khalid Ali
09-24-2003, 09:27 AM
document.frm.options[index].checked

will work

options is an array of checkboxes,therefore requires you t point to a specific index in the array to point to a single checkbox entry.

sorinc
09-24-2003, 09:37 AM
Thank you.

In this case i have 4 checkboxes, but in other case i don't know the size of the options[] if it's dinamic.
Is there a way to find options[] length?

Khalid Ali
09-24-2003, 09:42 AM
yes..

document.frm.options.length will give you the length.