Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pop Up with "Yes" and "No" buttons?

    Once a user presses the submit button on a form I have, I would like for a pop up to ask a question and instead of "OK" or "Cancel" as the buttons, I would like for the buttons to say "Yes" or "No". Whatever the user's choice is (Yes = 1 or No = 0), I would like to pass that value back to Coldfusion. How can I do this?

    James
    Last edited by jce1975; 03-11-2005 at 02:35 PM.

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    You cannot change the buttons on the javascript alert, but you can make your own vbscript prompts....I believe...

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How?

  • #4
    Regular Coder
    Join Date
    Jan 2004
    Location
    San Antonio, TX
    Posts
    131
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up go here to learn how

    Quote Originally Posted by jce1975
    How?

    http://javascriptkit.com/javatutors/vbalert.shtml

    This is where I learned. I actually asked this question a while back in this forum, and was told to do a search. Someone did it for me, and gave the answer, so I figure, I should at least give as much help as I got too... there may be other answers in these forums to other questions you may have... do a search before you ask and you might find your answers quicker.

    Hope this helps...

    Good Luck,

    Imperial Spider.

  • #5
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Surely you could just word your question differently.
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #6
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much, Imperial Spider! Javascript is new to me, so I was having a difficult time wording my question correctly ...

  • #7
    Regular Coder
    Join Date
    Feb 2005
    Posts
    679
    Thanks
    0
    Thanked 16 Times in 15 Posts
    Here is an example using javascript --
    Code:
    <script type="text/javascript">
    <!--
    /*<![CDATA[*/
    t = 0;
    function show_a() {
    brow = document.getElementById('alert').style;
    if (t == 0) {
    brow.visibility='visible';
    t = 1;
    }
    else {
    brow.visibility='hidden';
    t = 0;
     }
    }
    /*]]>*/
    // -->
    </script>
    
    <style type="text/css">
    /*<![CDATA[*/
    #alert { background-color: #6666cc;
             color: #eeeeff;
             width: 250px;
             height: 125px;
             text-align: center;
             padding-top: 30px;
             border: 2px double #ff99ff;
             visibility: hidden;
    }
    #b1 {  width: 75px;
           background-color: #66cc66;
           color: #ffffff;
    }
    #b2 {  width: 75px;
           background-color: #cc6666;
           color: #ffffff;
    }
    h4 { color: #ffff00;
         font-weight: 600;
         margin-top; 70px;
    }
    /*]]>*/
    </style>
    
    <form name="myform" id="myform" method="post" action="yourpage.cfm">
    <input type="text" name="answer" id="answer" value="" size="5">
    <input type="button" name="b0" id="b0" value="Submit" onClick="show_a()" />
    </form>
    
    <div id="alert">
    <h4>Are You Sure?</h4>
    <form name="q1" id="q1" method="post" action="">
    <input type="button" name="b1" id="b1" value="Yes" onClick="show_a(),ans.value=1,document.myform.submit();" />
    <input type="button" name="b2" id="b2" value="No" onClick="show_a(),ans.value=0,document.myform.submit();" />
    </form>
    </div>
    <script type="text/javascript">
    <!-- /*<![CDATA[*/
    ans = document.myform.answer;
    /*]]>*/
    // -->
    </script>
    /Bob


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •