Forum Moderators: open

Message Too Old, No Replies

About the confirm() function

javascript confirm() function

         

mista_phi

10:19 am on Sep 22, 2004 (gmt 0)

10+ Year Member



Is it possible to change the button values of the confirm() function from "OK" & "Cancel" to something else?

I'm looking for the same functionality as the Dialogs.confirm("message","ok","cancel") function in WMLScript... but using javascript instead.

At this point, I'm not sure that this is possible for javascript alone. Any assistance or direction would be greatly appreciated.

Bernard Marx

10:45 am on Sep 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The short answer is a most definite "no".

It's unfortunate, especially as the values of the buttons can be ambiguous under certain circumstances: "Would you like to cancel your order? " [ OK ][ Cancel ]

The only alternatives I can think of are IE only. For instance, VBScript has a wider range of control over modal dialogs, and it's not so tricky to wrap up a call to a VBS button (with their complicated binary '&' parameters) in a sensible JS function.

Your JS function could launch a VBS confirm dialogue for 70% of your users, while the rest get the normal.

There is also a modal dialog window. Yahoo have started using one. I don't know whether they are modal in the sense that all script stops.

dcrombie

6:13 pm on Sep 22, 2004 (gmt 0)



In some Mac browsers the buttons are [Yes] and [No] rather than [OK] and [Cancel].

mattglet

6:33 pm on Sep 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've always just based my questions on the OK and Cancel answers.

Rather than:
Would you like to cancel your order?

I would do something like:
You are about to cancel your order. Are you sure you want to do this?

I realize there's a ton of ways to do it, and 99% of those ways aren't "great".

mista_phi

7:46 pm on Sep 22, 2004 (gmt 0)

10+ Year Member



mattglet,
thanks 4 the suggestion, but the website is in a foreign language.

bernard,
thanks for the definite no... haven't wasted anymore time looking for something that doesn't exist. Not too familiar with VB though.

Thanks all