PDA

View Full Version : App.setAlert() and monitorValid problem



ezriel
3 Sep 2011, 6:18 AM
Hi,
i'm learnig extjs 4 and have a little problem. I tried use App.setAlert() from /examples/shared/extjs/App.js. When i lunch my app i got that message:

from firebug(on firefox 6) - App.js:157 String.format is undefined - Ext.core.DomHelper.append(this.msgCt, {html:this.buildMessageBox(status, String.format.apply(String, Array.prototype.slice.call(arguments, 1)))}, true).slideIn('t').pause(delay).ghost("t", {remove:true});
on chrome - uncaught TypeError: cannot call method 'apply' of undefined
Second problem: The log button isn't disabling when form is invalid. I set monitorValid to true and formBind to true.
Here is my code:


Ext.application({
name: 'AM',


appFolder: 'app',


launch: function() {
App = new Ext.App();
var login = new Ext.FormPanel({
defaultType:'textfield',
monitorValid:true,
border: false,
bodyPadding: 5,


items:[{
fieldLabel:'Login',
name:'login',
allowBlank:false,
value: ''
},{
fieldLabel: 'Hasło',
id: 'login-form-password',
name: 'password',
inputType: 'password',
enableKeyEvents: true,
allowBlank: false,
value: '',
listeners: {
keydown: function(field, e){
if (e.getKey() == e.ENTER) {
doLogin();
}
}
}
}],
buttons:[{
text:'Logowanie',
formBind: true,
scope: this,
handler: doLogin
}]
});


function doLogin() {

if(!login.getForm().isValid())
Ext.Msg.show({
title: 'Uwaga!',
msg: 'Uzupełnij wszytkie pola poprawnie.',
width: 280,
buttons: Ext.MessageBox.OK,
modal: true,
prompt: false,
icon: Ext.MessageBox.INFO
});
else
App.setAlert(true,'Loging...');
}
var win = new Ext.Window({
title: 'Logowanie do systemu',
layout:'fit',
width:300,
height:130,
closable: false,
resizable: false,
plain: true,
items: [login]
});
win.show();
}
});

Any idea?

skirtle
3 Sep 2011, 4:49 PM
Appears to be a couple of bugs.

String.format, on line 157 of App.js, no longer exists. It should be Ext.String.format. I'm not familiar with that example so I don't know how this mistake got through, perhaps it was written with the upgrade tools enabled?

As for formBind, I tested your code against 4.0.2 and it didn't work but it was fine against 4.0.5.

ezriel
4 Sep 2011, 1:46 AM
Thanks skirtle. Ext.format.String works :) Now i have to wait to be able to download extjs 4.0.5...

skirtle
4 Sep 2011, 9:23 AM
Now i have to wait to be able to download extjs 4.0.5...

It's only available to support subscribers. The next public release will be 4.1, which is expected to reach beta later this month.