Help insert this HTML code into CFFORM

Posted on 2006-03-30
Last Modified: 2013-12-24
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=",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=""></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,
Question by:jeffmace
    LVL 9

    Accepted Solution

    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:  AND - they're both great resources for this kind of thing.
    LVL 10

    Assisted Solution

    This article from asfusion 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

    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

    Join & Write a Comment

    Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
    Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
    This video discusses moving either the default database or any database to a new volume.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    728 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

    22 Experts available now in Live!

    Get 1:1 Help Now