Solved

Confirmation message before form submission in ColdFusion Flash Form?

Posted on 2010-08-16
2
870 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

738 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