As far as I've seen, you should be able to submit the format=Flash form in the
exact same way as a plain old html form. A caveat to this, of course, is that
this only works with the generic input types; if you are trying to update,
insert and delete cfgrid items, that is another story.
But anyway, what I did on mine, just like on all my old html forms, was to put
both a submit and MM_InsertRecord field on my form. To handle the form
submission, I simply looked for the state of "MM_InsertRecord", and proceeded
like normal. Here is a sample of one of mine:
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<!---Begin Form Insertion Functionality--->
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "myform">
<cfquery datasource="#request.dsn#">
INSERT INTO posts (PostID, PostTitle, PostDate, PostImage, CategoryID,
UserID, PostImageCaption, PostKeyword1, PostKeyword2, PostKeyword3, PostContent)
VALUES (
<cfif IsDefined("FORM.PostID") AND #FORM.PostID# NEQ "">
'#FORM.PostID#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.PostTitle") AND #FORM.PostTitle# NEQ "">
'#FORM.PostTitle#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.PostDate") AND #FORM.PostDate# NEQ "">
'#FORM.PostDate#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.fileNameField") AND #FORM.fileNameField# NEQ "">
'#FORM.fileNameField#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.CategoryID") AND #FORM.CategoryID# NEQ "">
#FORM.CategoryID#
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.UserID") AND #FORM.UserID# NEQ "">
#FORM.UserID#
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.PostImageCaption") AND #FORM.PostImageCaption# NEQ "">
'#FORM.PostImageCaption#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.PostKeyword1") AND #FORM.PostKeyword1# NEQ "">
'#FORM.PostKeyword1#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.PostKeyword2") AND #FORM.PostKeyword2# NEQ "">
'#FORM.PostKeyword2#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.PostKeyword3") AND #FORM.PostKeyword3# NEQ "">
'#FORM.PostKeyword3#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.PostContent") AND #FORM.PostContent# NEQ "">
'#FORM.PostContent#'
<cfelse>
NULL
</cfif>
)
</cfquery>
<cflocation url="../feeds/updatefeed.cfm?categoryID=#FORM.CategoryID#"
addtoken="yes">
</cfif>
<!---End Record Insertion FUnctionality--->
<!---Begin Script for handling File Upload and Display--->
<cfsavecontent variable="swf"><cfoutput><p><img id="upload" hspace="0"
vspace="0" src="fileUpload.swf"></p></cfoutput></cfsavecontent>
<cfsavecontent variable="uploadScript">
var uploadSwf = textArea.label.upload;
uploadSwf.upload("upload.cfm");
uploadBtn.enabled = false;
browseBtn.enabled = false;
myform.picture = "";
</cfsavecontent>
<cfsavecontent variable="checkVersion">
var version = getVersion();
var versionNumber = Number(version.substr(4,1));
if(versionNumber < 8)
{
var msg = '<p>This example requires Flash Player 8 <br><font
color="#0000ff"><a
href="
http://www.macromedia.com/software/flashplayer/public_beta/">Download it
from Macromedia</a></font></p>'
var alertSettings:Object = {title:'Warning', message: msg, width:200,
headerHeight:27 }
errorpopup = mx.managers.PopUpManager.createPopUp(this, FormErrorException,
true, alertSettings);
errorpopup.centerPopUp(this);
}
</cfsavecontent>
<cfsavecontent variable="browseScript">
var uploadSwf = textArea.label.upload;
var panelInfo = panelInfo;
var output = output;
var uploadListener = {};
var progressBar = progressBar;
var totalWidth = progressBarBackground.width;
var fileNameField = fileNameField;
var uploadBtn= uploadBtn;
var browseBtn= browseBtn;
var maxSize = 1024 * 300;
var myform = myform;
uploadSwf.addListener(uploadListener);
uploadSwf.browse([{description: "Image Files", extension:
"*.jpg;*.png;*.gif"}]);
_global.MathNumberParse= function(n)
{
return (n >> 0)+"."+ (Math.round(n*100)%100);
}
uploadListener.onSelect = function(selectedFile)
{
panelInfo.text = "Name: "+ selectedFile.name + "\n";
panelInfo.text += "Size: "+selectedFile.size+ " bytes\n";
panelInfo.text += "Type: "+selectedFile.type+ "\n";
panelInfo.text += "Creation Date: "+ selectedFile.creationDate+ "\n";
panelInfo.text += "Modification Date: "+ selectedFile.modificationDate+ "\n";
if(selectedFile.size < maxSize || maxSize == undefined)
{
uploadBtn.enabled = true;
output.text = "";
}
else
{
output.text = "The file selected exceeds maximum allowed size";
uploadBtn.enabled = false;
}
fileNameField.text = selectedFile.name;
}
uploadListener.onComplete = function()
{
output.text = "Upload complete";
myform.picture = fileNameField.text;
uploadBtn.enabled = false;
browseBtn.enabled = true;
}
uploadListener.onProgress = function(fileRef, bytesLoaded, bytesTotal)
{
progressBar.visible = true;
var kLoaded = bytesLoaded/1024;
var kTotal = bytesTotal/1024;
var loaded = (kLoaded < 1024) ? _global.MathNumberParse(kLoaded) + " KB":
_global.MathNumberParse(kLoaded/1024) + " MB";
var total = (kTotal < 1024) ? _global.MathNumberParse(kTotal) + " KB":
_global.MathNumberParse(kTotal/1024) + " MB";
var percentage = Math.round(bytesLoaded * 100 / bytesTotal);
output.text = percentage+ "% uploaded - ";
output.text += loaded + " of " + total;
progressBar.width = totalWidth / 100 * percentage;
}
uploadListener.onSecurityError = function(fileRef,errorString)
{
output.text = "Security Error: "+ errorString;
uploadBtn.enabled = true;
browseBtn.enabled = true;
}
uploadListener.onIOError = function(fileRef)
{
output.text = "IO Error";
uploadBtn.enabled = true;
browseBtn.enabled = true;
}
uploadListener.onHTTPError = function(fileRef,errorNumber)
{
output.text = "HTTP Error number:" + errorNumber;
uploadBtn.enabled = true;
browseBtn.enabled = true;
}
uploadListener.onCancel = function()
{
output.text = "Action cancelled";
browseBtn.enabled = true;
}
</cfsavecontent>
<cfsavecontent variable="buttonStyle">
border-thickness:0;
corner-radius: 0;
</cfsavecontent>
<cfsavecontent variable="progressBarStyle">
border-thickness:0;
corner-radius: 0;
fill-colors: #00CCFF, #0075D9;
theme-color: #00CCFF;
border-color:#00CCFF;
color:#ffffff;
</cfsavecontent>
<!---ENd Script for File Upload and Display--->