parky128
21 Feb 2012, 3:54 AM
Hi,
I am battling a very odd issue where I have a basic login window with a form and a few fields on, one of which is hidden.
Ext.define('PPExtranet.view.ui.LoginWindow', {
extend: 'Ext.window.Window',
draggable: false,
width: 400,
resizable: false,
closable: false,
title: 'Login',
modal: true,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'form',
itemId: 'loginform',
bodyPadding: 10,
url: '/session/BeginSession.json',
items: [
{
xtype: 'hiddenfield',
name: 'appID',
value: 45,
fieldLabel: 'Label',
anchor: '100%'
},
{
xtype: 'textfield',
name: 'loginname',
fieldLabel: 'User Name',
allowBlank: false,
anchor: '100%'
},
{
xtype: 'textfield',
inputType: 'password',
name: 'password',
fieldLabel: 'Password',
allowBlank: false,
anchor: '100%'
}
]
}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'bottom',
layout: {
pack: 'end',
type: 'hbox'
},
items: [
{
xtype: 'button',
itemId: 'btnLogin',
text: 'Login'
}
]
}
]
});
me.callParent(arguments);
}
});
The hidden field has a value set, and its only this value which gets posted through to the url configured on the form. If I enter text into the login and password text fields these get ignored and all that gets posted through for these are empty strings!
Here is my controller code which I have hooked up to the login button click event:
if (this.getLoginForm().getForm().isValid()) {
this.getLoginForm().getForm().submit({
success: function(form, action) {
Ext.Msg.alert('Success', Ext.encode(action.result.data));
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.message);
}
});
} else {
Ext.Msg.alert('Validation Error', 'Validation error');
}
The isValid call on the form is coming back as false even though my fields have values entered. If I break into my code and inspect the fields and their values, both are empty strings even through I have text entered into these on the screen.
This is completely stumping me, any suggestions?
I am battling a very odd issue where I have a basic login window with a form and a few fields on, one of which is hidden.
Ext.define('PPExtranet.view.ui.LoginWindow', {
extend: 'Ext.window.Window',
draggable: false,
width: 400,
resizable: false,
closable: false,
title: 'Login',
modal: true,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'form',
itemId: 'loginform',
bodyPadding: 10,
url: '/session/BeginSession.json',
items: [
{
xtype: 'hiddenfield',
name: 'appID',
value: 45,
fieldLabel: 'Label',
anchor: '100%'
},
{
xtype: 'textfield',
name: 'loginname',
fieldLabel: 'User Name',
allowBlank: false,
anchor: '100%'
},
{
xtype: 'textfield',
inputType: 'password',
name: 'password',
fieldLabel: 'Password',
allowBlank: false,
anchor: '100%'
}
]
}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'bottom',
layout: {
pack: 'end',
type: 'hbox'
},
items: [
{
xtype: 'button',
itemId: 'btnLogin',
text: 'Login'
}
]
}
]
});
me.callParent(arguments);
}
});
The hidden field has a value set, and its only this value which gets posted through to the url configured on the form. If I enter text into the login and password text fields these get ignored and all that gets posted through for these are empty strings!
Here is my controller code which I have hooked up to the login button click event:
if (this.getLoginForm().getForm().isValid()) {
this.getLoginForm().getForm().submit({
success: function(form, action) {
Ext.Msg.alert('Success', Ext.encode(action.result.data));
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.message);
}
});
} else {
Ext.Msg.alert('Validation Error', 'Validation error');
}
The isValid call on the form is coming back as false even though my fields have values entered. If I break into my code and inspect the fields and their values, both are empty strings even through I have text entered into these on the screen.
This is completely stumping me, any suggestions?