Results 1 to 5 of 5

Thread: ExtJs 6.7.0 modern-Ext.form.Panel fails to identify error responses for submit action

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium User
    Join Date
    Mar 2009
    Posts
    254

    Default ExtJs 6.7.0 modern-Ext.form.Panel fails to identify error responses for submit action

    Consider the following code-base from ExtJs 6.7.0 Modern Ext.form.Panel's class:

    Code:
    beforeAjaxSubmit: function (form, options, successFn, failureFn) {
    	var me = this,
    		url = options.url || me.getUrl(),
    		request = Ext.merge({}, {
    			url: url,
    			timeout: me.getTimeout() * 1000,
    			form: form,
    			scope: me
    		}, options);
    
    
    	delete request.success;
    	delete request.failure;
    
    
    	request.params = Ext.merge(me.getBaseParams() || {}, options.params);
    	request.header = Ext.apply({
    		'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    	}, options.headers || {});
    
    
    	request.callback = function (callbackOptions, success, response) {
    		var responseText = response.responseText,
    			responseXML = response.responseXML,
    			statusResult = Ext.data.request.Ajax.parseStatus(response.status, response);
    
    
    		if (form.$fileswap) {
    			var original, placeholder;
    
    
    			Ext.each(form.$fileswap, function (item) {
    				original = item.original;
    				placeholder = item.placeholder;
    
    
    				placeholder.parentNode.insertBefore(original, placeholder.nextSibling);
    				placeholder.parentNode.removeChild(placeholder);
    			});
    
    
    			form.$fileswap = null;
    			delete form.$fileswap;
    		}
    
    
    		me.setMasked(false);
    
    
    		if (response.success === false) {
    			success = false;
    		}
    
    
    		if (success) {
    			if (statusResult && responseText && responseText.length === 0) {
    				success = true;
    			} else {
    				if (!Ext.isEmpty(response.responseBytes)) {
    					success = statusResult.success;
    				} else {
    					if (Ext.isString(responseText) && response.request.options.responseType === "text") {
    						response.success = true;
    					} else if (Ext.isString(responseText)) {
    						try {
    							response = Ext.decode(responseText);
    						} catch (e) {
    							response.success = false;
    							response.error = e;
    							response.message = e.message;
    						}
    					} else if (Ext.isSimpleObject(responseText)) {
    						response = responseText;
    						Ext.applyIf(response, {success: true});
    					}
    
    
    					if (!Ext.isEmpty(responseXML)) {
    						response.success = true;
    					}
    					success = !!response.success;
    				}
    			}
    			if (success) {
    				successFn(response, responseText);
    			} else {
    				failureFn(response, responseText);
    			}
    		}
    		else {
    			failureFn(response, responseText);
    		}
    	};
    
    
    	if (Ext.feature.has.XHR2 && request.xhr2) {
    		delete request.form;
    
    
    		var formData = request.data = new FormData(form);
    
    
    		if (request.params) {
    			Ext.iterate(request.params, function (name, value) {
    				if (Ext.isArray(value)) {
    					Ext.each(value, function (v) {
    						formData.append(name, v);
    					});
    				} else {
    					formData.append(name, value);
    				}
    			});
    
    
    			delete request.params;
    		}
    	}
    
    
    	return Ext.Ajax.request(request);
    },
    When a 500 Internal error response is returned from the server with a proper json response format and success set to false, even then the following line above:

    Code:
    if (response.success === false) {
    fails. As "response" variable is an object above. There-by the subsequent logic marks an error response as success actually and causes success callback to be invoked.

  2. #2
    Sencha - Forum Administrator
    Join Date
    Sep 2017
    Posts
    1,006

    Default

    Thank you so much for your post. I apologize for the delay. I have shared this with the support staff to look into at their earliest convenience. Your patience is greatly appreciated! We do suggest using the support portal when you need assistance with a capability of a Sencha product, you have identified a situation where a products behavior is inconsistent with the product documentation and might indicate a software bug, or when the communication between you and Sencha needs to be private.

    Thanks again,

    Michele


  3. #3
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    569

    Default

    Hello Rahul,

    Thank you for contacting Sencha Support!

    I request you to provide a fiddle reproducing the issue to assist you in a better way.

    Regards,
    Kumar
    Sencha Support.

  4. #4
    Sencha Premium User
    Join Date
    Mar 2009
    Posts
    254

    Default

    Hi Kumar,

    Here's the fiddle that reproduces this issue:
    https://fiddle.sencha.com/#fiddle/2s8a

  5. #5
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    569

    Default

    Hello Rahul,

    This issue has been registered as a bug in our tracker, the reference Jira EXTJS-28342 will be linked here to track the status of the issue.

    Regards,
    Kumar
    Sencha Suport.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •