Commit 5754b428 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Support submit message customization

* Better error handling
* Fixed usage of submit() with doAction()
parent 24be3674
Ext.ux.ProgressFormPanel = function(config) {
Ext.ux.ProgressFormPanel = function(config,submitAjaxConfig) {
var submitMsg = 'Saving...';
// Check for submit message override
if (submitAjaxConfig && submitAjaxConfig.submitMsg) {
submitMsg = 'Logging in...';
}
config = Ext.apply({
bodyStyle: 'border:0px;',
autoHeight: true,
loadMsg: 'Loading...',
submitMsg:'Saving...'
submitMsg: submitMsg
}, config);
Ext.ux.ProgressFormPanel.superclass.constructor.call(this, config);
......@@ -34,15 +44,20 @@ Ext.ux.ProgressFormPanel = function(config) {
// Check if we have result.errors
} else if (action.result && action.result.errors) {
// Check if we just have a error code
if (action.result.data && action.result.data.ErrorCode) {
printStr += "Code: "+action.result.data.ErrorCode+"<br />";
printStr += "Reason: "+action.result.data.ErrorReason+"<br />";
// Add all errors
for (var i = 0; i < action.result.errors.length; i++) {
printStr += action.result.errors[i] + '<br />';
} else {
for (var i = 0; i < action.result.errors.length; i++) {
printStr += action.result.errors[i] + '<br />';
}
}
// Check if we just have a error code
} else if (action.result.data && action.result.data.ErrorCode) {
printStr += "Code: "+action.result.data.ErrorCode+"<br />";
printStr += "Reason: "+action.result.data.ErrorReason+"<br />";
// Check if we have an action response
} else if (action.response) {
printStr += action.response.responseText;
// Check if we just have a result
} else if (action.result) {
......@@ -98,7 +113,7 @@ Ext.extend(Ext.ux.ProgressFormPanel, Ext.FormPanel, {
submit: function(options){
this.getLoadMask().msg = this.submitMsg;
// Ext.ux.ProgressFormPanel.superclass.submit.call(this,options);
this.getForm().submit(options);
this.getForm().doAction('submit',options);
},
// Get load mask
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment