Skip to main content
January 14, 2009
Question

Javascript in CF Flash Forms

  • January 14, 2009
  • 3 replies
  • 640 views
Hey Guys,
This is my first attempt in trying use javascript in flash forms and it isn't going well. The code I have works perfectly in a regular form. Basically its a super simple javascript function, that takes the value of one box, increases it by 25% and assigns that value to another box. Here is my code.

This topic has been closed for replies.

3 replies

Inspiring
January 14, 2009
> To put more then a command or two into the event handler
> without making the code hard to ready the <cfsavecontent...>
> tag comes in handy.

With 7.0.2+ (I think) you can also use cfformitem type="script" and create functions that you can call from onChange, etc..
Inspiring
January 14, 2009
BTW, the answers are in the link Ian pointed you to. The main point of interest is that text fields use the property "text" instead of value.

SessionRecruitingTarget.text = SessionTotalSlots.text *1.25

Also, IIRC field "name" is used as the object "id" in the underlying object.
January 14, 2009
Thanks for the info.
Not what I wanted to hear, seeing as I don't know crap about action script (sidenote, web developing takes way too many languages, HTML, CSS, SQL, Javascript, XML, Cold Fusion, and now Actionscript?!). Anyone have some sample code that could do this for me real quick? I learn best using the copy paste modify method. Thanks!
Inspiring
January 14, 2009
kenji776 wrote:
> Hey Guys,
> This is my first attempt in trying use javascript in flash forms and it isn't
> going well. The code I have works perfectly in a regular form. Basically its a
> super simple javascript function, that takes the value of one box, increases it
> by 25% and assigns that value to another box. Here is my code.
>

And here I am doing the exact same thing today. Playing with Flash
forms for the first time. I just read that you can't use JavaScript
with Flash Forms, you have to use ActionScript and it must be in the
handler of the Flash Control. I.E.

<cfTextArea ... onChange="{actionScript}">

To put more then a command or two into the event handler without making
the code hard to ready the <cfsavecontent...> tag comes in handy.

<cfSaveContent variable="myActionScript">
{Plots and lots of ActionScript}
</cfSaveContent>

<cfTextArea ... onChange="#myActionScript#">

This provided a good overview for me.
http://www.adobe.com/devnet/coldfusion/articles/adv_flashforms.html