PDA

View Full Version : how to get the response from my button



same66
20 Sep 2010, 12:53 AM
Hi all,
I'm coding with the extJs framework, and i have a question.
I want to get the response from my button on a errorBox.

my code is the following :



success : function(objServerResponse) {
var ans = eval('(' + objServerResponse.responseText + ')');
if (ans.result == "success") {
Ext.MessageBox.show( {
closable : false,
title : ans.title,
msg : ans.msg,
buttons : eval(ans.buttons),
fn : function() {
var buttons = eval(ans.buttons);
if (buttons.ok == 'Confirm') {
this.close();
copyPartValid();
} else {
this.close();
}

},
icon : eval(ans.icon)
});

And i want check if the user click on Confirm or not. But i know that my test is false.
Do you have help for me please ?

PS : I very sorry for my bad english, I'm a french.

Thank you for advance !

Lloyd K
20 Sep 2010, 2:45 AM
Look at the Ext.MessageBox documentation, the callback function is supplied with the button that was clicked, for example:



Ext.MessageBox.show({
...
buttons: Ext.MessageBox.OKCANCEL,
scope: this,
fn: function(btn) {
alert("You clicked: " + btn);
}
});

same66
20 Sep 2010, 4:17 AM
Thank you very well !