Using CFMX 7 and Flash forms - trying to call a javascript from within the form and capture values - help?

Posted on 2005-04-21
Last Modified: 2013-12-24
I have a fairly simple flash from, and I am trying to have either a link inside the flash form, or outside the flash, execute a javascript that will perform an XmlHTTP request, passing values from inside the flash form.  Here is my code right now (in development, so semi-messy)
<script type="text/javascript">
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();

// function getfile will perform our request using our created xmlhttp object //
function getfile() {
      // this line refers to our input box named filename //
      document.getElementById('searchResults').innerHTML = "<center><img src='images/pleasewait.gif'></center>";
      var Current = "search.cfm?origincity=" + document.myform.origincity.value + "&originstate=" + document.myform.originstate.value + "&destinationcity=" + document.myform.destinationcity.value + "&destinationstate=" + document.myform.destinationstate.value;"GET", Current, true);
      xmlhttp.onreadystatechange=function() {
            if (xmlhttp.readyState==4) {
            document.getElementById('searchResults').innerHTML = xmlhttp.responseText;

      <table width="720" cellspacing="0" cellpadding="0" border="1px solid black">
                        <cfform name="myform" format="flash">
                              <cfformgroup type="horizontal">
                                    <cfinput name="origincity" label="Origin City"> <cfinput name="originstate" label="Origin State">
                              <cfformgroup type="horizontal">
                                    <cfinput name="destinationcity" label="Destination City"> <cfinput name="destinationstate" label="Destination State">
                              <cfinput type="submit" name="Submit" value="Submit" >
<div id="searchResults" title="searchResults" style="position:relative; display:block; width:100%;"></div>

The object of this is to present the user with a nice clean looking flash form, and instantly pull the results of the search up in a DIV below the flash form.  I want this to appear seamless, and not make the user re-load the flash form each time they search.  I can make this work just fine with a html formatted form, but I want to take advantage of the new CF features!  Is there a way to do this using some type of action scripts, or some javascript magic I can use?

Thanks in advance!

Chris Peterson
Question by:JUSTICE
    LVL 1

    Author Comment

    I am not gonna get any love on this one eh? =)  So, is there any way to communicate from Coldfusion 7 MX's auto-generated flash files to a javascript on the same page?
    LVL 12

    Accepted Solution

    You should be able to use the actionscript element on the flash form to call the action script command fscommand() - this enables you to interact with javascript on the page.
    LVL 12

    Expert Comment


    or you can try <cfform name="myform" format="flash" onSubmit="getFile();">
    LVL 12

    Expert Comment

    and you will need to change the js references to something like this: document.applets[0].getVariable("origincity.value");
    LVL 1

    Author Comment

    you are my hero! =)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now