Radio Buttons Require onclick in Lower Case for Flash Forms
When I originally started working with ColdFusion in 2000, I wrote all of my tags in upper case, both CFML and HTML. I don't believe I was the only one to do this, I think I carried this technique over from an old HTML standard. Anyways, times have changed and I've attempted to keep up. For instance, when typing Javascript event handlers such as onClick, I try to use the appropriate case making the C upper and the rest lower.
Recently I've been updating a Flash Form application that I wrote last year. It is a form for accepting donations for several charities on behalf of my employer. Originally we only accepted payroll deductions to be processed one time or over 26 pay periods. This meant that I had a pair of radio buttons both named Payments, one had a value of 26 and one had a value of 1.
This year we wanted to add check processing which, of course, would only be a single payment. So I added another pair of radio buttons with the intent that if the radio button for check were clicked it would set the number of payments to 1 and disable the original pair of radio buttons.
I spent hours trying to get this to work right, banging my head against my desk. No matter what I tried nothing worked. I tried onClick, onSelect, onChange on the new radio buttons. I tried binding the old radio buttons. I tried a text box with conditional logic to tie these radio buttons together. I searched and scoured the internet and found nothing.
Finally I made what I originally considered a typo, a mistake; I didn't capitalize the C in onClick. It worked! In ColdFusion 7 (maybe this is fixed in 8), the ActionScript onclick event for Radio buttons must be in lower case for Flash Forms. I created a button and used the traditional casing for onClick and that worked fine.
The following is the code that demonstrates what I've found:
Recently I've been updating a Flash Form application that I wrote last year. It is a form for accepting donations for several charities on behalf of my employer. Originally we only accepted payroll deductions to be processed one time or over 26 pay periods. This meant that I had a pair of radio buttons both named Payments, one had a value of 26 and one had a value of 1.
This year we wanted to add check processing which, of course, would only be a single payment. So I added another pair of radio buttons with the intent that if the radio button for check were clicked it would set the number of payments to 1 and disable the original pair of radio buttons.
I spent hours trying to get this to work right, banging my head against my desk. No matter what I tried nothing worked. I tried onClick, onSelect, onChange on the new radio buttons. I tried binding the old radio buttons. I tried a text box with conditional logic to tie these radio buttons together. I searched and scoured the internet and found nothing.
Finally I made what I originally considered a typo, a mistake; I didn't capitalize the C in onClick. It worked! In ColdFusion 7 (maybe this is fixed in 8), the ActionScript onclick event for Radio buttons must be in lower case for Flash Forms. I created a button and used the traditional casing for onClick and that worked fine.
The following is the code that demonstrates what I've found:
<cfform format="Flash">
<cfformgroup type="panel" label="Testing">
<cfformitem name="mesg" type="html">Select Donation Method:</cfformitem>
<cfinput type="radio" name="paymethod" label="Payroll Deduction" value="payroll" onclick="Payments.enabled = true;" checked="1">
<cfinput type="radio" name="paymethod" label="Pay by Check" value="check" onclick="Payments.enabled = false; Payments.selectedData = 1;">
<cfformitem name="mesg" type="html">Select Number of Payments:</cfformitem>
<cfinput type="radio" name="Payments" label="Per Pay Period (26)" value="26" checked="1">
<cfinput type="radio" name="Payments" label="Single Pay Period (1)" value="1">
<cfinput name="bSubmit" type="button" value="Click Me!" onClick="alert('Click!')">
</cfformgroup>
</cfform>

