Changing the button labels in a confirm box

L

leosarasua

I am writing a page in French and I need to create a confirm box, but
I want to change the labels of the buttons from "OK" and "Cancel" into
"Oui" and "Non".

I've looked around and it seems impossible to do this, so my question
is: why is the confirm method so restrictive? All it needs is a
question string and two labels for the true and false buttons. Why was
it defined with only one parameter, instead of, let's say one
mandatory and two optional parameters? If there is no reason, then
would it be possible to request a modification to the Javascript
standard? If two optional parameters are added, it would still be
backward compatible, and it would make life easier to those who, like
me, need to write code in other languages.

Please comments.
 
E

Evertjan.

wrote on 02 dec 2007 in comp.lang.javascript:
I am writing a page in French and I need to create a confirm box, but
I want to change the labels of the buttons from "OK" and "Cancel" into
"Oui" and "Non".

I've looked around and it seems impossible to do this, so my question
is: why is the confirm method so restrictive? All it needs is a
question string and two labels for the true and false buttons. Why was
it defined with only one parameter, instead of, let's say one
mandatory and two optional parameters? If there is no reason, then
would it be possible to request a modification to the Javascript
standard? If two optional parameters are added, it would still be
backward compatible, and it would make life easier to those who, like
me, need to write code in other languages.

Confirm() is a browser specific function,
not part of the Javascript specs, methinks.

This Q seems to pop up every week or so.

Please read the FAQ and the archive.

<http://www.jibbering.com/faq/#FAQ4_28>
 
T

Thomas 'PointedEars' Lahn

I am writing a page in French and I need to create a confirm box, but I
want to change the labels of the buttons from "OK" and "Cancel" into
"Oui" and "Non".

It will be most certainly be "Oui" and "Non" in a French user agent (UA) by
default.
[...] If there is no reason, then would it be possible to request a
modification to the Javascript standard?

No. You don't understand that the alert() method has not been part of the
JavaScript language long since, or any other ECMAScript implementation for
that matter. It is part of the DOM, an API provided by the UA, which can be
used with ECMAScript-binded interfaces.

See http://PointedEars.de/es-matrix (updated).


PointedEars
 
V

VK

You will have to write your own "in window" confirm box if you want to
have any control at all over what the wording is.

It could be nothing more than a simple div element with a textbox for
input and two buttons to click on.

Right - and the modality option? ;-) This question is really a FAQ but
this post stays aside because it is not so much about "how?" but "why
not implemented?" - and the fair answer would be "nobody knows". For
IE it never was a problem because first anyone could bridge JScript to
VBScript MsgBox where the prehistoric limitation in question did not
exist. After window.showModalDialog it really was not a problem at
all. Lucky other are starting to pick up to the current demand, say
upcoming Firefox will have showModalDialog as well:
http://developer.mozilla.org/en/docs/DOM:window.showModalDialog

For the time being one can use different pseudo-modal emulations. Out
of 5sec search for instance:
http://slayeroffice.com/code/custom_alert/
http://javascript.about.com/b/2007/09/28/modal-dialog-box.htm
 
T

Thomas 'PointedEars' Lahn

Thomas said:
It will be most certainly be "Oui" and "Non" in a French user agent (UA) by
default.

Sorry, I meant "OK" and the French equivalent of "Cancel" ("Annuler"?) of
course.


PointedEars
 
L

leosarasua

Sorry, I meant "OK" and the French equivalent of "Cancel" ("Annuler"?) of
course.

PointedEars

I couldn't get access to a French browser, but if what you say is
true, then it adds another problem to confirm, because you don't know
anymore what the buttons will say when a user opens your page in
another part of the world. You could end up having something like
this: "Click OK to proceed or Cancel to review your order: <<OK>>
<<Annuler>>", which would leave the user wondering where is the
"Cancel" button?
Obviously, there should be more control on confirm and, from what I
see here, there is no reason for it to be so restricted. So what are
the Browser designers waiting for?
 
T

Thomas 'PointedEars' Lahn

Thomas said:
(e-mail address removed) wrote:
I am writing a page in French and I need to create a confirm box, but I
want to change the labels of the buttons from "OK" and "Cancel" into
"Oui" and "Non".
It will be most certainly be "Oui" and "Non" in a French user agent (UA) by
default.
Sorry, I meant "OK" and the French equivalent of "Cancel" ("Annuler"?) of
course.
[...]

I couldn't get access to a French browser, but if what you say is
true, then it adds another problem to confirm, because you don't know
anymore what the buttons will say when a user opens your page in
another part of the world. You could end up having something like
this: "Click OK to proceed or Cancel to review your order: <<OK>>
<<Annuler>>", which would leave the user wondering where is the
"Cancel" button?

You would employ means to make sure that the message is in the same language
as the buttons, or not refer to the button captions at all, of course.
Obviously, there should be more control on confirm and, from what I
see here, there is no reason for it to be so restricted. So what are
the Browser designers waiting for?

Even more incompetent developers?


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top