...

View Full Version : Pop Up with "Yes" and "No" buttons?



jce1975
03-11-2005, 03:30 PM
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? :confused:

James

Brandoe85
03-11-2005, 04:35 PM
You cannot change the buttons on the javascript alert, but you can make your own vbscript prompts....I believe...:cool:

jce1975
03-11-2005, 09:46 PM
How? :eek:

ImperialSpider
03-12-2005, 02:42 AM
How? :eek:


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.

hemebond
03-12-2005, 04:39 AM
Surely you could just word your question differently.

jce1975
03-12-2005, 05:34 PM
Thank you very much, Imperial Spider! Javascript is new to me, so I was having a difficult time wording my question correctly ...

rwedge
03-12-2005, 11:52 PM
Here is an example using javascript --

<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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum