PDA

View Full Version : Uncaught TypeError: Object [object Object] has no method 'getEl'



bunty
22 Sep 2012, 8:37 PM
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,

vietits
23 Sep 2012, 12:10 AM
Ext.form.Basic has no method getEl(). Try to fix your code as below:


buttons: [{
text: 'Submit',
handler: function() {
// search.getForm().getEl().dom.action = 'FormServlet';
// search.getForm().getEl().dom.method = 'POST';
search.getForm().submit({
url: 'FormServlet',
method: 'POST'
});
}
}]

bunty
23 Sep 2012, 12:21 AM
what will be the value for the url? I have given it as the servlet name (i.e. the servlet name present in my web.xml) but it is not working. LoginServlet is the class name present under the package src/com.controller package. The jsp files are present under the web content/jsp folder. Then what will be the value for the url here?

I am getting an 404 error, it seems to trigger the url : The requested resource (/Demo/jsp/FormServlet) is not available.

vietits
23 Sep 2012, 12:28 AM
1. See more information for submit options here: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.Basic-method-doAction.

2. Error "The requested resource (/Demo/jsp/FormServlet) is not available" means "/Demo/jsp/FormServlet" Url does not exist.

bunty
23 Sep 2012, 12:59 AM
gone through the link suggested.

when i check the properties of FormServlet.java, i got the path. In the url, i matched the same url with this:../src/com/controller/FormServlet but still it did not worked......Not sure what exactly the url is expecting :(