From: edward Date: Fri, 4 Nov 2016 06:24:44 +0000 (+0800) Subject: Pman.Dialog.CoreCompanies.bjs X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=4a3adcede6a118d6cd69a172390ac09c38ef5daf Pman.Dialog.CoreCompanies.bjs Pman.Dialog.CoreCompanies.js --- diff --git a/Pman.Dialog.CoreCompanies.bjs b/Pman.Dialog.CoreCompanies.bjs index 95641ae2..f61ed878 100644 --- a/Pman.Dialog.CoreCompanies.bjs +++ b/Pman.Dialog.CoreCompanies.bjs @@ -266,7 +266,7 @@ }, { "listeners" : { - "click" : "function (_self, e)\n{\n if(!_this.form.isValid()){\n Roo.MessageBox.alert('Error', 'Please Correct all the errors in red');\n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/Core_company.php',\n method : 'POST',\n params : {\n id : _this.form.findField('id').getValue() * 1,\n name : _this.form.findField('name').getValue(),\n _check_name : 1\n }, \n success : function(res) {\n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n },\n failure : function(res) {\n Roo.log(res);\n }\n });\n \n return;\n \n}" + "click" : "function (_self, e)\n{\n if(!_this.form.isValid()){\n Roo.MessageBox.alert('Error', 'Please Correct all the errors in red');\n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/Core_company.php',\n method : 'POST',\n params : {\n id : _this.form.findField('id').getValue() * 1,\n name : _this.form.findField('name').getValue(),\n _check_name : 1\n }, \n success : function(res) {\n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n },\n failure : function(res) {\n Roo.MessageBox.confirm(\n \"Confirm\", \n \"The company name has been used. Save it anyway?\", \n function(res) {\n if(res != 'yes') {\n return;\n }\n \n _this.dialog.el.mask(\"Saving\");\n _this.form.doAction(\"submit\");\n }\n );\n }\n });\n \n return;\n \n}" }, "text" : "Save", "xtype" : "Button", diff --git a/Pman.Dialog.CoreCompanies.js b/Pman.Dialog.CoreCompanies.js index 949437f6..9ceef5e0 100644 --- a/Pman.Dialog.CoreCompanies.js +++ b/Pman.Dialog.CoreCompanies.js @@ -118,7 +118,18 @@ Pman.Dialog.CoreCompanies = { _this.form.doAction("submit"); }, failure : function(res) { - Roo.log(res); + Roo.MessageBox.confirm( + "Confirm", + "The company name has been used. Save it anyway?", + function(res) { + if(res != 'yes') { + return; + } + + _this.dialog.el.mask("Saving"); + _this.form.doAction("submit"); + } + ); } });