javascript - Extjs how submit form without ajax? -


good day! try submit extjs form without ajax , show result on next page. 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 other page doesn't occur , receive error: you're trying decode invalid json string. can me? thank you!

ok, have 2 error.

  1. why not redirect(standarssubmit), and
  2. why got "error decode"

i guess you're using extjs4:

1 . docs api. submit() method shortcut submit action. , parameter the options pass action (see doaction details). so, putting standardsubmit submit method isn't correct way. there no standardsubmit option. more info. myanswer, have 2 alternative way.
first, use init:

ext.apply(this,{     standardsubmit:true,  // not working...     frame: true,     bodypadding: 7,     ....... 

edits:

....... me.getform().standardsubmit=true; //just 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 . error decode, don't know salary/public/auth like....
try first solution, if error exists, mean error somewhere else...


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -