A reader asks:

Not sure this is quite normal, but I have a CF Form, flash format, that based on options selected, submit to different action pages.

My Question is, do you know how to access and modify the "action" attribute of a CFForm using ActionsScript from a function in '<cfformitem type="script">' function?

It may very well be possible to change the action of a Flash Form. However, I wasn't sure of how to do that, so I simply used the onsubmit method. Consider the following code block:

<cfform format="flash" width="200" height="200" onsubmit="return goURL()">

<cfformitem type="script"> function goURL() { var url = destination.value.toString(); getURL(url); return false; } </cfformitem>

<cfselect name="destination"> <option value="http://www.cflib.org">CFLib</option> <option value="http://www.coldfusioncookbook.com">ColdFusion Cookbook</option> <option value="http://ray.camdenfamily.com">My Blog</option> </cfselect>

<cfinput type="submit" value="Go There!" name="submit" />


This relatively simple block of code does a few things. First, it specifies an action to take on form submission. Notice I used "return goURL()" instead of just "goURL()", this was because I wanted the default form submission to not fire. My goURL() function is contained with a script form item block. This is only allowed in ColdFusion 7.0.1. The ActionScript code simply grabs the value of the form below it (which will be a URL), and then calls getURL() to load it.