PDA

View Full Version : Not able to retrive data submitted in a form



singh.bk
13 Nov 2011, 1:38 AM
I have the following in my formpanel

Ext.onReady(function(){
var simple = new Ext.form.FormPanel({
standardSubmit: true,
frame:true,
title: 'Login',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',
items: [{
fieldLabel: 'Username',
name: 'username',
id: 'username',
allowBlank:false
},
{
fieldLabel: 'Password',
id: 'password',
name: 'password',
allowBlank:false
}
],
buttons: [{
text: 'Submit',
type: 'submit',
handler: function() {

simple.getForm().getEl().dom.action = 'http://www.myurl.com/rest/validate?';
simple.getForm().getEl().dom.method = 'POST';
simple.getForm().submit();
}
}]
});
simple.render('mytraditionalform');
});

When I try to read the request object in the server side, the params list is empty. None of the parameters(username, password) is being passed along with the form.

request.getParameterNames() is an empty enum on the server side.

Can someone help me debug the issue?

Thanks

singh.bk
13 Nov 2011, 2:02 AM
If I use 'GET' instead of POST, I am able to retrive the data.
But POST is not working.

mitchellsimoens
13 Nov 2011, 6:52 AM
Instead of this:


simple.getForm().getEl().dom.action = 'http://www.myurl.com/rest/validate?';
simple.getForm().getEl().dom.method = 'POST';
simple.getForm().submit();

Try this:


simple.getForm().submit({
url : 'http://www.myurl.com/rest/validate',
method : 'POST' //should be default so you shouldn't have to specify this
});