javascript - Why is my ExtJS form not submitting? -
i'm using extjs pop window simple edit form, on pressing submit button, no xhr call made , this.form.el.dom undefined
error reported in console.
here's code:
var mynamespace = new function(){ var editform, editwindow; this.init = function(){ ext.ajax.request({ url: '/server/action.php', success: function(result){ console.log('ajax working ok'); // } }); editform = new ext.form.formpanel({ width:450, autoheight: true, header : false, items: [{ name: 'color', fieldlabel: 'color', xtype: 'textfield', value: 'blue' }], buttons: [{ text:"submit", scope: this, // tried without this, handler: function(){ // editform.getform().getvalues() returns normal values editform.getform().submit({ url: '/server/action.php', success: function(form, action) { console.log('yes! success!'); // don't }, failure: function(form, action) { console.log('failed.'); // don't } }); editwindow.close(); // works console.log('the form closed'); // } }] }); editwindow = new ext.window( { title:'enter color', autowidth: true, autoheight: true, layout: 'fit', modal: true, items: editform, closeaction: 'hide' }); editwindow.show(); }; }; ext.onready(function () { mynamespace.init(); });
any light on subject appreciated , profusely upvoted.
i going issue asynchonous nature of form submital. form closes before response received ajax submit event. try moving editwindow.close()
line inside success processing block.
Comments
Post a Comment