PDA

View Full Version : standardSubmit issue



nar
8 Sep 2009, 11:31 AM
3.0 still having issues with standardSubmit? Saw a few post about this and I am unable to get it going. I hit submit and it just refreshes the page.



var form = new Ext.FormPanel({
standardSubmit: true,
url:'submit.cgi' (http://www.extjs.com/forum/'submit.cgi'),
frame:true,
bodyStyle:'padding:5px 5px 0',
items: [{
......

var win = new Ext.Window({
autoScroll: true,
width:500,
height:300,
border: false,
items: [form],
buttons: [{
text:'Submit',
handler: function(){
form.getForm().submit();
//~ win.destroy();
}
},{
text: 'Close',
handler: function(){
win.destroy();
}
}]
});

Jack9
8 Sep 2009, 12:07 PM
http://www.extjs.com/deploy/dev/docs/?class=Ext.form.BasicForm (http://www.extjs.com/forum/../deploy/dev/docs/?class=Ext.form.BasicForm)

This is where standardSubmit comes from.

Unfortunately, it doesnt seem to mention that the "basic submit" is somewhat asynchronous.
Unlike a "regular" form, submitting through standardSubmit does not load the serverside page at all. It just submits like you would expect, throws away the response, and reloads the url it came from (AFAIK).

What you want is:
form.getForm().load();

I think.

httpdotcom
8 Sep 2009, 12:14 PM
To prevent any scope issues, and to correct the call,

var frm = new Ext.form.FormPanel( {...


And what you probably need is

...handler: function() {
Ext.Ajax.request( {
url: "submit.cgi",
params: frm.getForm().getValues(),
success: function() {...},
failure: function() {...}
} ) ;
}


And when you destroy the window, you are also destroying your form panel. I hope this is all called inside a function, or you won't be able to open it again and see any contents. Or, you can just use win.close() with closeAction: "close" in your window config.

Screamy
24 Jun 2010, 4:01 AM
Realizing that the previous post to this thread was almost a year ago, I thought I'd reply in case it helps someone else:

I encountered this same problem with ExtJs/Sencha version 3.2.1 and found that for some reason, my form was failing validation, so the standard submit action was being canceled. No fields were highlighted in red and all field values appeared to be valid, but validation was still failing. To get around the problem, I disabled "clientValidation" and the submit worked like a champ.



myForm.getForm().submit({clientValidation: false})