Solved

Confirmation message before form submission in ColdFusion Flash Form?

Posted on 2010-08-16
2
882 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
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 live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

688 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