[Javascript] getting form fields by name

Alastair Moore alastair at alastairmoore.co.uk
Mon Oct 21 07:54:32 CDT 2002


Hi all,

I have a form such as below -

<form action="" method="post" name="createevent">
<input type="checkbox" name="culture_all" value="culture_chk"
onClick="checkBoxes(this.form, this.checked, this.value)">Culture Vultures
<input type="checkbox" name="culture_chk" value="18">jo
<input type="checkbox" name="culture_chk" value="26">Bill
<input type="checkbox" name="culture_chk" value="28">Alf
<input type="checkbox" name="sporty_all" value="sporty_chk"
onClick="checkBoxes(this.form, this.checked, this.value)">Sporty Types
<input type="checkbox" name="sporty_chk" value="25">Luke
<input type="checkbox" name="party_all" value="party_chk"
onClick="checkBoxes(this.form, this.checked, this.value)" disabled>Party
Animals
<b>No friends in this category</b>
<input type="checkbox" name="others_all" value="other_chk"
onClick="checkBoxes(this.form, this.checked, this.value)" disabled>Others
<b>No friends in this category</b>
</form>

What I'm trying to do is check if all the "culture_chk" checkboxes have been
checked and if so check the culture_all check box. Should a user unclick one
of the culture_chk checkboxes, the culture_all checkbox will not be checked.
Does anyone have any suggestions how this can be done?

Thanks!

Welly




More information about the Javascript mailing list