If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Copy checkbox and radio button value to hidden field

Hi,
I have a form that has text fields, text areas, checkboxes and a radio button. I need to copy the content of the form to hidden fields in another form. I've managed to copy the text fields and text areas to hidden fields but I can't copy the value of the checkboxes or radio button.

I have four separate checkboxes and each one is unique and will copy to a unique hidden field. Each checkbox will have a value of Y if checked and I'd like the hidden field to have a value of N if the checkbox is not checked and Y if it is checked.

The same rule applies for the radio button, it can either be Y (checked) or N (not checked).

As mentioned above, I've already got a JavaScript function (on an onclick event) that copies the text fields and text areas so I just want to add the copy checkbox value code into my existing function.

The main form stores page content data into a database - the idea is for users to be able to preview what their content will look like "before" they save (submit) the main form. My idea was if I could copy the form fields (of the main form) to another form (with hidden fields) the user could "submit" the second form to a new page to preview their content (this would open in a new window) - if they are happy with their content they can close the preview window and "save" (submit) the main form to save the content to the database.

so far my code works for the text fields and text areas of the main form but not for the checkboxes and radio buttons. Here is the code so far (I've removed most of the text fields and text areas for clarity and there will be a few more checkboxes in the finished form: