Forum Moderators: open

Message Too Old, No Replies

javascript confirm() always returns false

         

quasi

9:01 pm on Nov 1, 2006 (gmt 0)

10+ Year Member



A client of ours has noticed a failure in functionality. Upon investigation it was beacause a confirm() call always returned false. We were unable to reproduce the problem. It seemed to only occur on their system. Here is the function code:

<script type="text/javascript">
<!--
function Failover()
{
if( confirm('Are you sure you want to failover?') == true)
{
document.myForm.CNFRM.value = "true";
return true;
}
else
return false;

}
-->
</script>

Anyone familiar with this problem?
Thanks.

Windows with IE.

Rambo Tribble

11:20 pm on Nov 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just for kicks, what happens if you omit the '== true' (which shouldn't be necessary, anyway)?

Though, it sounds like the if statement is executing before confirm returns its value, meaning you might try

x=confirm(~etc.);
if(x){
~etc.
}

[edited by: Rambo_Tribble at 11:22 pm (utc) on Nov. 1, 2006]

eelixduppy

11:43 pm on Nov 1, 2006 (gmt 0)



Make it as basic as you can to test the problem.

If this doesn't work then there is a very strange problem:


if(confirm("Work?")) {
alert("True");
} else {
alert("False");
}