I'm currently working on an application (more details later) which will make heavy use of flash forms, and will be made with the mach-ii framework. I needed a method to trigger diferent mach-ii events from the same form - let me explain.
I have a list with items in a cfgrid. Now I wanted to mark one item, and click one of two buttons: "Properties" and "Delete". The first thing I tried was to have the two buttons named "event" and asign different values to them:
<cfinput type="submit" name="event" value="Properties">
<cfinput type="submit" name="event" value="Delete">
However I learned that you can not have two form fields with the same name in a flash form. It won't render at all.
So I got the idea to have a hidden field called "event", and then have onclick functions on the buttons asigning different values to the hidden field. However I could not make it work. So I fired of an email to Mike Nimer, the guy behind the before mentioned cfform.com. He answered me, sugesting a small change of the syntax in my onclick function, and behold, it worked. Here's a rough example:
<cfform name="form1" action="index.cfm" method="post" preloader="yes" format="flash" height="500" width="710">
<cfinput type="hidden" name="event" value="">
<cfinput type="submit" name="eventone" value="Properties" width="100" onclick="form1.event='properties'">
<cfinput type="submit" name="eventtwo" value="Delete" width="100" onclick="form1.event='delete'">
Looking at it now I can't beleive I did not figure out the syntax my self (I left out the name of the form). A big thank you to Mike!!!