PDA

View Full Version : submit form, getValues not working



vivendi
5 Oct 2011, 6:41 AM
I have a fieldset with a few textfields which i want to submit to my server. But i can't get the getValues() method to work. Can someone please help me out with this??

This is what i have so far:


items: [{
xtype: 'fieldset',
id: 'rform',
title: 'Title will come here',
instructions: 'Instructions here',
defaults: {
labelWidth: '35%'
},
items: [{
xtype: 'textfield',
name: 'name',
label: 'Name',
required: true,
useClearIcon: true
},{
xtype: 'passwordfield',
name: 'password',
label: 'Password',
required: true,
useClearIcon: true
},{
xtype: 'emailfield',
name: 'email',
label: 'Email',
required: true,
useClearIcon: true
},{
xtype: 'button',
text: 'Registratie voltooien',
handler: function () {
var values = this.getValues();
// Things i've tried:
// var values = this.rform.getValues();
// var values = Ext.getCmp('rform').getValues();
alert(values);
}
}]
}]

jiindal1988
1 Nov 2011, 11:18 PM
You need to create items inside form, for example try the code given below:

var myform=new Ext.form.FormPanel({
id:'form',
url: 'phpserverurl',
fullscreen:true,
standardSubmit:true,


items:[
{
xtype:'textfield',
name:'username',


align:'center',
label:'Username:',
},
{
xtype:'passwordfield',
name:'password',
id:'pwd',
align:'center',
label:'Password:'
},


{
xtype:'button',
text:'Login',
margin: 30,
align:'center',
handler:function()
{
var form = myform.getValues();
// in variable form you will get username and password value
myform.submit();

}
}
],
});

Hope this helps.