Solved

Confirmation message before form submission in ColdFusion Flash Form?

Posted on 2010-08-16
2
798 Views
Last Modified: 2013-11-11
I need to have an alert box pop up that requires the user to confirm or cancel the form submission. I found the following example on asfusion, but it doesn't actually submit the form. If I try and apply this to the submit button I see the confirmation box pop up for a second before the form submits, which obviously is useless. Can this be done?

<cfsavecontent variable="showAlert">
      var myObj = {};
       var myClickHandler = function (evt){
        if (evt.detail == mx.controls.Alert.OK){
                alert("Records deleted","Completed");
        }
}
alert("Are you sure you want to remove all records?", "Warning", mx.controls.Alert.OK |
mx.controls.Alert.CANCEL,  myClickHandler);
</cfsavecontent>
<cfform name="myform" height="300" width="400" format="Flash" timeout="0" >
       <cfformgroup type="hbox">
                <cfinput type="Button" name="myBtn" onClick="#showAlert#" value="Show Alert" />                   
      </cfformgroup>
</cfform>
0
Comment
Question by:pcmelby
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
Comment Utility
This tip seems to do the trick
http://www.webmasterkb.com/Uwe/Forum.aspx/cold-fusion/8411/cfgrid-and-a-confirm-delete-message


<cfform name="myform" action="somePage.cfm" height="300" width="400" format="Flash" timeout="0">
      <cfformitem type="script">
            function confirmSubmit() {
                  var myObj = {};
                   var confirm = function (evt){
                        if (evt.detail == mx.controls.Alert.OK)
                        {
                              _root.submitForm();
                        }      
                  }
                  alert("Are you sure you want to remove all records?",
                              "Warning",
                              mx.controls.Alert.OK | mx.controls.Alert.CANCEL,  
                              confirm
                        );
            }            
      </cfformitem>
       <cfformgroup type="hbox">
                <cfinput type="Button" name="myBtn" onClick="confirmSubmit()" value="Show Alert" />                  
      </cfformgroup>
</cfform>
0
 

Author Closing Comment

by:pcmelby
Comment Utility
Thanks!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

743 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

14 Experts available now in Live!

Get 1:1 Help Now