Blesta Addons Posted May 25, 2014 Report Posted May 25, 2014 i'm coding a new plugin , when i add a country i don't get any error if the data is invalidfor exmple a invalid fields (alpha2 /alpha3) if (!empty($this->post)) { // print_r($this->post); // $this->Countries->add($this->post); if (!($errors = $this->Countries->add($this->post))) { $this->setMessage("error", $errors, false, null, false); $vars = (object)$this->post; } $this->flashMessage("message", Language::_("AdminToolsPlugin.countries.!success", true), null, false); $this->redirect($this->base_uri . "plugin/admin_tools/admin_countries/"); } what wrong with this ?! Quote
Blesta Addons Posted May 25, 2014 Author Report Posted May 25, 2014 Sorry resolved, is my fault , my eyes are closed , is 02:24 in our local time correct code for reference if (!empty($this->post)) { $vars = (object)$this->post; $this->Countries->add($this->post) ; if (!($errors = $this->Countries->errors())) { $this->flashMessage("message", Language::_("AdminToolsPlugin.countries.!success", true), null, false); $this->redirect($this->base_uri . "plugin/admin_tools/admin_countries/add/"); } $this->setMessage("error", $errors, false, null, false); $this->set("countries", $vars); } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.