PDA

View Full Version : [3.x] BasicForm Standsubmit not working



jahman
4 May 2009, 5:25 AM
Hello,

I wanted to use the standard form submit I was using a while ago today, to my suprise I am getting error message.



O.getForm is not a function


Has there been any changes made since Version 2.0 that allows the below code not function.


if (O.getForm().isValid()) {
if (O.url)
O.getForm().getEl().dom.action = O.url;
if (O.baseParams) {
for (i in O.baseParams) {
O.add({
xtype: "hidden",
name: i,
value: O.baseParams[i]
})
}
O.doLayout();
}
O.getForm().submit();
}

4 May 2009, 9:30 AM
have you tried setting a break point and verifying that O == instanceof Ext.form.FormPanel ??

jahman
5 May 2009, 10:32 PM
have you tried setting a break point and verifying that O == instanceof Ext.form.FormPanel ??

I thougth the below code from the tutorial would always work. Is there a need setting a breaking point?



buttons: [
{ text: "Save",
handler: function() {
var O=this.ownerCt;
if(O.getForm().isValid()){
if(O.url)O.getForm().getEl().dom.action=O.url;
if(O.baseParams){
for(i in O.baseParams){
O.add(
{ xtype:"hidden",
name:i,
value:O.baseParams[i]
})
}
O.doLayout();
}
O.getForm().submit();
}
}
}]

6 May 2009, 2:01 AM
Of course! The breakpoint would tell you that O.ownerCt does not have a getForm method. Further inspection might reveal that O.ownerCt == instanceof Ext.Toolbar!