Skip to main content
Armek Mareki
Participant
September 17, 2010
Answered

Flash form onclick event not working

  • September 17, 2010
  • 2 replies
  • 1756 views

Can not get onClick syntax to work correctly. Help is much appreciated.

<cfform  action="nexpage.cfm" target="_self" method="post"  enctype="application/x-www-form-urlencoded" name="frm1"  format="flash"   width="900" height="700" skin="haloblue">

<cfformgroup type="horizontal"> 
   <cfformitem type="text" width="300" enabled="yes">How did you learn of our online process?</cfformitem>

   <cfinput type="radio" name="lead" label="Newspaper"  value="1" onClick="document.frm1.newspaper.disabled=false" />

      <cfselect disabled="true" visible="yes" name="newspaper" id="newspaper" multiple="no" width="250" >
               <option value="">Select one</option>
               <option value="1">option 1</option>
               <option value="2">option 2</option>
               <option value="3">option 3</option>
    </cfselect>
</cfformgroup>

<cfformgroup type="horizontal"> 
   <cfformitem type="spacer" width="300" enabled="yes" />

   <cfinput type="radio" name="lead" label="Job Center"  value="2" onClick="document.frm1.JCenter.disabled=false" />

     <cfselect disabled="true" visible="yes" name="JCenter" id="JCenter" multiple="no" width="250" >
          <option value="">Select one</option>
          <option value="1">option 1</option>
          <option value="2">option 2</option>
          <option value="3">option3</option>
    </cfselect>

  
</cfformgroup>

</cfform>

This topic has been closed for replies.
Correct answer -__cfSearching__-
onClick="document.frm1.newspaper.disabled=false"

It looks like you are using javascript. Flash forms use actionscript. It is a totally different beast.

UPDATE:

Never mind.  My previous suggestion will not work because the radio fields have the same name.  I am sure there are better ways.

But you could call a function onClick. One that changes the state of the select lists..

    <cfformitem type="script">
        function setListState() {
            newspaper.enabled = (lead.selectedData == 1);
            JCenter.enabled = (lead.selectedData == 2);
        }
    </cfformitem>
   <cfinput type="radio" name="lead" label="Newspaper" value="1" onClick="setListState()">

    ...
   <cfinput type="radio" name="lead" label="Job Center"  value="2"  onClick="setListState()">

Message was edited by: -==cfSearching==-

2 replies

Inspiring
September 18, 2010

Is the onClick doing anything at all?

Inspiring
September 19, 2010

Yes, it works if you use actionscript instead of javascript.

-__cfSearching__-Correct answer
Inspiring
September 17, 2010
onClick="document.frm1.newspaper.disabled=false"

It looks like you are using javascript. Flash forms use actionscript. It is a totally different beast.

UPDATE:

Never mind.  My previous suggestion will not work because the radio fields have the same name.  I am sure there are better ways.

But you could call a function onClick. One that changes the state of the select lists..

    <cfformitem type="script">
        function setListState() {
            newspaper.enabled = (lead.selectedData == 1);
            JCenter.enabled = (lead.selectedData == 2);
        }
    </cfformitem>
   <cfinput type="radio" name="lead" label="Newspaper" value="1" onClick="setListState()">

    ...
   <cfinput type="radio" name="lead" label="Job Center"  value="2"  onClick="setListState()">

Message was edited by: -==cfSearching==-

Armek Mareki
Participant
September 17, 2010

I always use the same name for a group of radio buttons.

The selects are all different names as those are distinct. Radio buttons are part of same 'grouping'

Inspiring
September 17, 2010

Of course, and that makes sense. I simply meant the first technique I described would not work here, because it is designed to work with a different type of object (radiobutton versus radiobuttongroup).  Anyway, take a look at the suggested alternative in my edited post.

Message was edited by: -==cfSearching==-