Flash forms and mach-ii

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!!!

Comments
Borrowed the code you posted. It doesn't work. Have you actually tried this? If you unhide the text field, you'll find it stays blank.

=(
# Posted By CHall | 4/11/05 11:27 PM
I have tried the code, and it works. If you unhide the textfield it wont work though, because there's a diferent syntax for setting a value to a normal text field.

Then you would have to use something like

onclick="event.text='delete'"

You can find more about it at: http://livedocs.macromedia.com/coldfusion/7/htmldo...
# Posted By Trond Ulseth | 4/12/05 9:36 AM