PDA

View Full Version : Add a one variable in showResultText function



mahes
7 Jul 2009, 3:27 AM
HI all,

Am new bee for JS. I like JS simplicity. I have using message box prombt getting values to procedd further action. See the code

function dofunction(sele)
{ var sele=sele;
Ext.MessageBox.prompt('Document Id', 'Please enter Document id:',showResultText);
}
function showResultText(btn, text,sele){alert(sele);
Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text "{1}".', btn, text);
//document.location=rootURL + '/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId='+11;
};
In that function i want to add one more variable with btn, text. Because i need to pass the selected option...How can i add one more in showResultText box .....

Thanks in advance.....

Condor
7 Jul 2009, 3:44 AM
1. Please use [CODE] tags!
2. You can add parameters to a callback function using the createDelegate method, e.g.

function dofunction(sele){
Ext.MessageBox.prompt('Document Id', 'Please enter Document id:',
showResultText.createDelegate(null, [sele], 2)); // insert 'sele' as 3rd parameter
};
function showResultText(btn, text, sele){
alert(sele);
Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text "{1}".', btn, text);
//document.location=rootURL + '/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId='+11;
};