Groups | Blog | Home
all groups > coldfusion flash integration > july 2006 >

coldfusion flash integration : Javascript submit() function



jnoonan
7/7/2006 6:29:14 PM
:disgust;
Ok, I've been working on this all day and I hoping someone can help me.

The alerts work correctly, but the form never submits. I've tried changing the
cfinputs to read submit versus button. When I do that, it blows by the JS
alerts and submits the page. I need the alerts to appear BEFORE submitting the
page.

<cfform name="LINAdmin" method="post" action="prereqBranch.cfm" format="flash">
<cfformitem type="script">
function submitButton(type) {
if (type == "Transition LIN") {
if (resultsGrid.selectedItem.lin == undefined) {
alert("You must select a LIN to transition.");
return false;
} else {
alert("Before you can mark a LIN for transition, you must complete the
following form.");
LINAdmin.Submit();}
}
}
</cfformitem>

<cfformgroup type="horizontal" style="horizontalAlign:center;">
<cfinput type="button" name="branch" value="Transition LIN"
onClick="submitButton('Transition LIN')">
<cfinput type="button" name="branch2" value="LIN Remains"
onClick="submitButton('LIN Remains')">
</cfformgroup>
</cfform>

THANK YOU!
Jennifer
The ScareCrow
7/10/2006 11:47:55 PM
Your actually using actionscript and not javascript.

Thus the code your looking for is

else {
alert("Before you can mark a LIN for transition, you must complete the
following form.");
submitForm();}
}

Ken

jnoonan
7/11/2006 12:51:13 PM
Thanks Ken, however now it's behaving as if I changed the cfinput to submit
versus button. The alert pops up but before you can click OK, the page is
submitted.

How can I tell it to submit only if the user clicks the OK button?

Thanks again.
The ScareCrow
7/11/2006 11:32:37 PM
jnoonan
7/12/2006 2:31:29 PM
Great! This is what worked. Thanks ScareCrow!

function submitButton() {
var myClickHandler = function (evt){
if (evt.detail == mx.controls.Alert.OK){
_root.submitForm();
}
}

alert("Before you can mark a LIN for transition, you must complete the
following form.", "Alert", mx.controls.Alert.OK | mx.controls.Alert.CANCEL,
myClickHandler);
}

Great web site for ActionScript help, http://www.asfusion.com.

AddThis Social Bookmark Button