[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 978
  • Last Modified:

Confirmation message before form submission in ColdFusion Flash Form?

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
pcmelby
Asked:
pcmelby
1 Solution
 
_agx_Commented:
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
 
pcmelbyAuthor Commented:
Thanks!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now