Ext.require([
'Ext.form.*'
]);
var win;
Ext.onReady(function() {
Ext.apply(Ext.form.VTypes, {
password: function(val, field) {
if (field.initialPassField) {
var pwd = field.up('form').down('#' + field.initialPassField);
return (val == pwd.getValue());
}
return true;
},
passwordText: 'Passwords do not match'
});
form = Ext.FormPanel({
layoutConfig: {
itemCls: 'x-abs-layout-item',
},
baseCls: 'x-plain',
defaultType: 'textfield',
fieldDefaults: {
msgTarget: 'side'
},
url: '<%=users_path%>',
items: [{
fieldLabel: 'Логин:',
name: 'login'
},{
fieldLabel: 'Email:',
vtype: 'email',
name: 'email'
},{
fieldLabel: 'Password',
name: 'pass',
id: 'pass',
inputType: 'password'
},{
fieldLabel: 'Confirm Password',
name: 'pass-cfrm',
inputType: 'password',
vtype: 'password',
initialPassField: 'pass'
}],
buttons: [{
text: 'Зарегистрироваться'
},{
text: 'Отмена',
handler: function(){
win.hide();
}
}]
})
win = Ext.create('Ext.window.Window', {
title: 'Регистрация',
closeAction: 'hide',
bodypadding: 10,
width: 300,
bodyStyle: 'padding: 10px; background-color: #D0DEF0;',
height: 220,
minHeight: 220,
minWidth: 300,
layout: 'fit',
resizable: true,
animCollapse: true,
collapsible: true,
constrain: true,
modal: true,
items: [form]
})
win.show()
})
При валидации паролей, выдает ошибку
Код:
|
field.up("form") is undefined
http://localhost:3000/javascripts/ext-application.js?1300805203/eval/seq/261
Line 9 |
WTF?