Javascript for if x then set y to z

I have a radio button and when choice[0] is selected then the value of field1 needs to match the value of fieldx… and so on. Here’s what I have that doesn’t work:

frm=document.forms[0];

if(frm.choice[0].checked) {

frm.field1.value = frm.fieldx.value

} else etc…

Thanks in advance for any advice!

Subject: javascript for if x then set y to z

There is nothing wrong with the code you posted. I tested and it works fine. Make sure your form is set to generate html for all fields if any of the fields are hidden.

Subject: Thank you

Thank you for testing and for the clues!