Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confirm Popup 1

Status
Not open for further replies.

Nebooaw

Programmer
Jun 1, 2001
142
GB
Hi, i have a drop down list with 3 values (1,2&3)

The default selected value is set like...

Code:
<%if Priority = 1 then response.write "selected"%>

I want a confirm dialog to pop up if the user changes the current slection. If the user selects ok, then the new value is set. if cancel is selected then the old value is put back.

Can anyone help?

this is what i was trying to do...

Code:
<script LANGUAGE="JavaScript">
function confirmChange()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
	return true ;
else
	return false ;
	document.form1.Priority.value = "3";
}
</script>

Kindest thanks.
 
<script LANGUAGE="JavaScript">
function confirmChange()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
return true ;
else
return false ;
document.form1.Priority.selectedIndex = 2;
}
</script>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Code:
function confirmChange()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
{
    return true ;
}
else
{
    document.form1.Priority.selectedIndex = 2;
    return false ;
}
}

--Chessbot

"So it goes."
Kurt Vonnegut, Slaughterhouse Five
 
I have tried both of the methods above but i have to select ok or cancel twice before the dialog goes away. Any ideas?

kind regards.
 
Function, slightly cleaned up, but the same as chessbot's:

Code:
<!--
function confirmChange() {
    if (confirm("Are you sure you wish to continue?")) {
        return true;
    } else {
        document.form1.Priority.selectedIndex = 2;
        return false;
    }
}
-->

Way to call the function:

Code:
<select name="Priority" onchange="[red]return [/red]confirmChange();">

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Thanks for replying, i was using onpropertychange

cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top