View Full Version : Change 'Yes' messageBox

17 Jan 2011, 5:38 AM
Hey all,

I searched on the forum how i can change the value of the messagebox.confirm 'yes and 'no', but it didn't work for me.

Code i have at the moment is to define an specific handler to yes and to no, so if i change the values to what i want: 'Ja' and 'Nee', than I can change this for the handler:

var applyBox = new Ext.MessageBox({
items: applyJobForm,
cls: 'msgBoxSend'

confirm : function(title, msg, fn, scope) {
return this.show({
title : title,
msg : msg,
buttons: Ext.MessageBox.YESNO,
fn: function(button) {
if (button == 'yes') {
fn.call(scope, 'yes');
} else {
fn.call(scope, 'no');
scope : scope,
icon: Ext.MessageBox.QUESTION

applyBox.confirm('Solliciteren?', 'Wilt u solliciteren voor deze functie?', function(button) {
if (button == 'yes') {
waitMsg : {message:'Opsturen'}

So question is, how to change the 'Yes' to 'Ja', and 'No' to 'Nee'.

Greetz Kevin

17 Jan 2011, 6:05 AM
In sencha-touch-debug-w.comments.js you will find something like this:

var B = Ext.MessageBox;

Ext.apply(B, {
OK : {text : 'OK', itemId : 'ok', ui : 'action' },
CANCEL : {text : 'Cancel', itemId : 'cancel'},
YES : {text : 'Yes', itemId : 'yes', ui : 'action' },
NO : {text : 'No', itemId : 'no'},
// Add additional(localized) button configs here

// ICON CSS Constants
INFO : 'x-msgbox-info',
WARNING : 'x-msgbox-warning',
QUESTION : 'x-msgbox-question',
ERROR : 'x-msgbox-error'

Ext.apply(B, {
// Add additional button collections here


I didn't check this, but "apply(..." could be the solution..

17 Jan 2011, 6:17 AM
Exactly, you can apply your own text to the buttons in this simple way:

Ext.apply(Ext.MessageBox.YES, {text: 'Ja'});
Ext.apply(Ext.MessageBox.NO, {text: 'Nee'});

This is like how the Ext locale files works.
So, I suggest you to make your own locale file to include before any other script in your page but after the sencha-touch.js.

Hope this helps.

17 Jan 2011, 7:21 AM
Thx a lot both!

Appreciate it ;)

17 Jan 2011, 7:24 AM
You are welcome!

17 Jan 2011, 7:33 AM
Any chance i can add this apply to a custom messagebox? One i did create myself? Because sometimes I want 'Ja', but sometimes I want something else ^^

var applyBox = new Ext.MessageBox({
items: applyJobForm,
cls: 'msgBoxCls'

I created them like that, problem is I can't put an ID on it, because it will be created in an handler (and if you get more than 1 object with same ID, sencha doesn't work well).

17 Jan 2011, 1:22 PM
You will have to extend Ext.MessageBox probably to allow that in the best way.