"undefined" value for radio button???

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
For some reason I am getting an undefined value on a radio button on my
form. You can see in the HTML snippet below that I am setting values on all
the buttons, and have the "No" button selected by default. Yet when I
finally submit the form the javascript shows the value for the radio button
as "undefined"

I know this is going to be a stupid mistake, but can anyone explain what I'm
doing wrong?

---HTML snippet---

<form action="doForm.asp" method="post" onsubmit="return Validate(this)"
  <!--some other fields -->
  <input type="radio" name="ReceiveCC_i" value="No" checked >No
  <input type="radio" name="ReceiveCC_i" value="Yes" >Yes
  <input type="submit" value=" Submit Form " name="SUBMIT">

---Javascript snippet---

function Validate(f) {
  /*Alert shows "undefined' ??? */
  alert (f.elements['ReceiveCC_i'].value);

  /* If ReceiveCC is YES, we need to append email address to CC field
  if ( f.elements['ReceiveCC_i'].value == "Yes" ) {
    f.elements['CC'].value = f.elements['CC'].value + "; " +

Re: "undefined" value for radio button???

Quoted text here. Click to load it

But what does doForm.asp show as the value when you take the
JavaScript out? i.e. what is actually being sent to the server?

Quoted text here. Click to load it

RecieveCC_i doesn't have a value.
RecieveCC_i is an array of the individual radio buttons. You need to
find which one is selected and then find the value for that one.


"My theories appal you, my heresies outrage you,
 I never answer letters and you don't like my tie."  - The Doctor

Re: "undefined" value for radio button???

Quoted text here. Click to load it

Thanks... I've changed the code to:
   if ( f.elements['ReceiveCC_i'][1].checked ) {
and it works. I could have sworn that I'd used the VALUE property before

Just wondering now if there was a way to use something like


Site Timeline