• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Flash form onclick event not working

Community Beginner ,
Sep 17, 2010 Sep 17, 2010

Copy link to clipboard

Copied

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>

TOPICS
Advanced techniques

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Sep 17, 2010 Sep 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);
        

...

Votes

Translate

Translate
Valorous Hero ,
Sep 17, 2010 Sep 17, 2010

Copy link to clipboard

Copied

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==-

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 17, 2010 Sep 17, 2010

Copy link to clipboard

Copied

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'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 17, 2010 Sep 17, 2010

Copy link to clipboard

Copied

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==-

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 18, 2010 Sep 18, 2010

Copy link to clipboard

Copied

Is the onClick doing anything at all?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 18, 2010 Sep 18, 2010

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation