step through them all, a radio button is NOT a separate array, it is
a group of checkboxes, that have the same name, and only one may be
checked.. you need to find which one...

<input type="radio" name="WorkStatus" value="1" /> Active <br />
<input type="radio" name="WorkStatus" value="0" /> Inactive <br />

var fe = theForm.elements;
for (var i=0; i<fe.length; i++) {
  if (fe[i].name == "WorkStatus" && fe[i].checked)
    iWorkStatus = fe[i].value
}

Paul Broomfield wrote:
Hello,

I'm doing a wee bit a client side for validation.

I want to check that a radio button has been checked, I step through the
element array and reference the radio buttons with:

theForm.elements[i].....

theForm is a var pointing to my form in this case document.forms.ClaimForm

I have several radio buttons all with the same name, when I try to count
them, in the loop it doesn't work but using the element name is does work
eg:

theForm.elements["WorkStatus"].length - works

but

theForm.elements[i].length - doesn't work

I know that i is pointing to the right element as I can grab the name
and/or the checked status eg

theForm.elements["WorkStatus"].name

does any have any ideas
--
-----------------------------------------------------------------------
 Michael J. Ryan                          |      ICQ: 4935386
     tracker1(at)theroughnecks(dot)com    |  AIM/AOL: azTracker1
 Roughneck BBS:                           |    Yahoo: azTracker1
     http://www.theroughnecks.net         |      MSN: (email address)
     telnet://theroughnecks.net           | Trillian: www.trillian.cc


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to