[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

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

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;
      xmlhttp.open("GET", Current, true);
      xmlhttp.onreadystatechange=function() {
            if (xmlhttp.readyState==4) {
            document.getElementById('searchResults').innerHTML = xmlhttp.responseText;
            }
      }
      xmlhttp.send(null)
}
</script>

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

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
0
JUSTICE
Asked:
JUSTICE
  • 3
  • 2
1 Solution
 
JUSTICEAuthor Commented:
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?
0
 
mmc98dl1Commented:
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.
0
 
mmc98dl1Commented:
http://www.moock.org/webdesign/flash/fscommand/

or you can try <cfform name="myform" format="flash" onSubmit="getFile();">
0
 
mmc98dl1Commented:
and you will need to change the js references to something like this: document.applets[0].getVariable("origincity.value");
0
 
JUSTICEAuthor Commented:
you are my hero! =)
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now