Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 640
  • Last Modified:

Help insert this HTML code into CFFORM

I am trying to learn how to use action script and CF FORMS, this is the first time I have been trying to use it.  Basically I am trying to load mp3 files dynamically.  Here is my code:

<cfquery name="x" datasource="jem_music">

<cfform format="Flash">
  <cfgrid name="UsersGrid" format="Flash" query="x" maxRows="5" rowheaders="Yes">
    <cfgridcolumn name="song" header="Song Title">
    <cfgridcolumn name="band" header="Group Name">
    <cfgridcolumn name="category" header="Category">
  <cfformitem type="text" name="song" label="Song Name" bind="Song Title: {UsersGrid.dataProvider[UsersGrid.selectedIndex]['song']}">}"></cfformitem>
  <cfformitem type="text" name="band" label="Band" bind="Group Name: {UsersGrid.dataProvider[UsersGrid.selectedIndex]['band']}"></cfformitem>
  <cfformgroup type="horizontal">
  <cfformitem type="html" height="100" width="100" bind=""></cfformitem>

Basically all I want to do is load the "Wimpy Button" (which is a flash mp3 player) with a mp3 file dynamically from my database.  Here is the code they use


      <!-- Start Wimpy Button Code -->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0" name="wimpy_button01"
 WIDTH="40" HEIGHT="40" id="wimpy_button_1">
      <PARAM NAME=movie VALUE="wimpy_button.swf?theFile=example.mp3">
      <PARAM NAME=quality VALUE=high>
      <PARAM NAME=wmode VALUE=transparent>
      <EMBED src="wimpy_button.swf?theFile=example.mp3" WIDTH="40" HEIGHT="40" quality=high NAME="wimpy_button01"
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
<!-- End Wimpy Button Code -->

I have a column in my mySQL database called mp3 which has the file name like testfile.mp3, so I want to bind this flash code with the grid so that if i choose i different song with the grid it will change this line below to reflect what the new mp3 file name is:

<PARAM NAME=movie VALUE="wimpy_button.swf?theFile=example.mp3">

So to sum it all up, how can I include the mp3 button into my grid code so that I can play an MP3 file dynamically.

Thank you,
2 Solutions
Although it is possible to dynamically assign a value within the row of the grid and have it link (you can see how this is done here):


If you change the link url to be a popup you could easily use this.

The other possibility would be to have two versions of the form (one that shows if an ID is passed) and one that shows if it wasn't.  Then outside the flash form just use an iframe or simply make your form only take up part of the page - and place the HTML part at the bottom.

Due to the limitations of the <cfformitem type="html"> I am not aware of any way to use embeded objects within the flash form itself.  In order to do this you would need to code the connector in Actionscript and use the <cfformitem type="script"> and code an AS function that could then be called at the bottom of the form.  Sorry I can't provide a complete example of this or test it but hopefully someone much better at actionscript can assist.  You can always check the following two sites for expanded 'hacks' of the CFFORM and AS integration:

http://www.cfform.com  AND http://www.asfusion.com - they're both great resources for this kind of thing.
This article from asfusion http://www.asfusion.com/blog/entry/file-upload-explained-and-expanded seems to suggest that you could include your mp3 player swf directly into a hidden text area (without the embedded object tags).

You would pass the name of the file and a start or stop command using actionscript in a similar fashion to the way they do with this file upload swf, but the methods that they call in this article are a function of the file upload swf and how that part is done I'm afraid I am totally in the dark.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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