Solved

Confirmation message before form submission in ColdFusion Flash Form?

Posted on 2010-08-16
2
812 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
ID: 33448313
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
ID: 33448724
Thanks!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

920 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