Extjs how submit form without ajax?
ok, so you have 2 error.
- why not redirect(standarssubmit), and
- why you got "error decode"
i guess you're using extjs4:
1 . From the docs api. it say that submit()
method is Shortcut to do a submit action
. and the parameter is The options to pass to the action (see doAction for details)
. so, putting standardSubmit
to submit
method isn't the correct way. there is no standardSubmit option. more info. myanswer, you have 2 alternative way.
first, use the init:
Ext.apply(this,{
standardSubmit:true, // not working...
frame: true,
bodyPadding: 7,
.......
Edits:
.......
me.getForm().standardSubmit=true; //just like OP comment
me.getForm().submit({
url: '/salary/public/auth/',
standardSubmit: true,
method: 'POST'
});
.......
second, use doAction:
...
me.getForm().doAction('standardsubmit',{
url: '/salary/public/auth/',
standardSubmit: true,
method: 'POST'
});
...
2 . the error decode, i don't know what is your salary/public/auth
look like....
try my first solution, if error exists, it mean the error is somewhere else...
vedmed
Updated on June 26, 2022Comments
-
vedmed almost 2 years
Good day! I am try submit extjs form without ajax and show result on the next page. This is my code:
Ext.define('test.from', { extend: 'Ext.form.Panel', alias: 'widget.test.form', initComponent: function () { var me = this; Ext.apply(this, { frame: true, bodyPadding: 7, border: 0, items: [{ xtype: 'textfield', fieldLabel: 'First Name', name: 'contact_attr' }, { xtype: 'textfield', fieldLabel: 'Last Name', name: 'contact_attr' }], buttons: [{ text: 'Send', handler: function () { me.getForm().submit({ url: '/salary/public/auth/', standardSubmit: true, method: 'POST' }); } }] });
But redirect to other page doesn't occur and I receive error:
You're trying to decode an invalid JSON String
. Can anybody help me? Thank you!