Change Hidden Field W/checkbox
I have a form that I’m using and it’s within a system that I have limited control over, so I need some javascript that will pass the value of a checkbox to a hidden field. When the checkbox is checked, the hidden field should have the value of the checkbox, and when it’s unchecked it should have no value.
The script needs to be able to place the initial checkbox value in the hidden field and also toggle that value if the checkbox changes.
Here is the code that is being used for the checkbox. I don’t have any control over this code. But I can add other javascript functions to the page. Note: the page is using Prototype, so any javascript can either utilize that library or else it needs to not conflict with it. I can make the hidden input field be whatever I need it to be. Here is the checkbox code:
<input
type=’checkbox’
id=’subscription’
name=’subscription’
onclick=”LPG.updatePaymentOptions(this,’product’);if( LPG.subscriptionOnClick!=undefined){LPG.subscriptionOnClick(this)};”
checked=’checked’
/>


