When I execute the below code, i can see an exception in my chrome logged like:
Uncaught TypeError: Object [object Object] has no method ‘getEl’
var search = new Ext.form.Panel({
renderTo: 'pan',
title: 'Basic Panel',
collapsible:true,
width: 400,
defaults: {width: 230},
defaultType: 'textfield',
bodyPadding: 10,
//layout: 'form',
frame:true,
items: [{
fieldLabel: 'Username',
name: 'username',
id: 'username',
allowBlank:false
},
{
fieldLabel: 'Password',
name: 'password',
inputType:'password',
allowBlank:false
},
{
fieldLabel: 'First Name',
name: 'firstname',
inputType:'text',
allowBlank:false
},
{
fieldLabel: 'Last Name',
name: 'lastname',
inputType:'text',
allowBlank:false
},
{
fieldLabel: 'E-Mail Address',
name: 'email',
vtype:'email',
allowBlank:false
},
{
fieldLabel: 'State',
name: 'state',
allowBlank:false
},
{
fieldLabel: 'City',
name: 'city',
allowBlank:false
},
{
fieldLabel: 'Country',
name: 'country',
allowBlank:false
},
{
inputType: 'hidden',
id: 'submitbutton',
name: 'myhiddenbutton',
value: 'hiddenvalue'
}
],
buttons: [{
text: 'Submit',
handler: function() {
search.getForm().getEl().dom.action = 'FormServlet';
search.getForm().getEl().dom.method = 'POST';
search.getForm().submit();
}
}]
I have defined the servlet in the web.xml file which contains the name, class and url.
Please let me know how to resolve this issue.
Regards,
Don’t make it that complicated. I guess ExtJS overrides your settings or didn’t use them at all cause you didn’t used the appropriate config properties to set this.
Here are the API links for both
Here is your demo code extended with these
Or do it this way to be more flexible