customized confirmation message box

I have a customized confirmation message box that pops up when a cfform is submitted.  My code is below.  My problem is the code doesn't wait for the user to confirm the submission.  The message box pops up temporarily and then the form is submitted without the user selecting a button.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> 
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script  type="text/javascript">
    //Function to show results of other message boxes.
    var showResult2 = function(btn){
            if (btn == 'yes'){
        alert("You clicked Agree button: "+btn);
        alert("You clicked Cancel button: "+btn);
    //The button onClick handler displays the message boxes.
    function showMB(mbox)  {;
<cfform name="dg" action="test.cfm">
    <p>Click a button display the corresponding message box.</p>
    <cfinput name="Prompt" type="submit" value="Submit" onclick="showMB('mymessagebox02')">
<!--- Code to define the message boxes. --->                    
<cfmessagebox name="mymessagebox02" bodystyle="font-family: Arial, Helvetica, sans-serif" type="confirm" title="Warning:"  
        message="Are you sure you want to proceed?"  
        labelNO="Cancel" labelYES="Agree"
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The problem is that you are actually submiting the form with your input tag called "Prompt".. that should be changed from type submit to type button.

Then in your pop up message, when the user agrees, that button press action should submit the form..
curtis247Author Commented:
Changing the input type to button instead of submit stopped the form from submitting, but now how do I submit the form?  Currently I see my temporary alert that tells me what button was pressed.  What should I replace the alert with to submit the form?
(no points...)

Like gd mentioned, change your callback function to submit the form. So replace the temporary alter with something like

var showResult2 = function(btn){
          if (btn == 'yes'){
               // note, I added an "ID" to your cfform

<cfform id="yourFormID" name="dg" action="test.cfm">

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

curtis247Author Commented:
Thank you, that worked perfectly.
curtis247 - I appreciate the points, but in fairness I think it should at least be a split since gd correctly explained why it wasn't working and how to fix it. I just provided a code snippet to illustrate his explanation.  If you're amenable, you can use the request attention and ask a moderator to reopen the question so you can reallocate.
curtis247Author Commented:
I agree. Sorry for the mistake.  I will correct as soon as possible.
Thanks to both of you !
Thanks curtis!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.