Nishanthan93 Posted July 30, 2020 Share Posted July 30, 2020 i am developing module for CRUD operations . created form using fields_form . all the functionality are working correctly and the validation also working correclty But the validation error message was not displayed . i am created a admin controller in my module . AdminController public function __construct() { parent::__construct(); $this->bootstrap = true; $this->table = 'econt_shipping_cost'; $this->identifier = 'id'; $this->className = 'EcontShipping'; $this->allow_export = true; $this->_defaultOrderBy = 'a.id'; $this->fields_list = [ 'id' => ['title' => 'ID','class' => 'fixed-width-xs'], 'weight_from' => ['title' => 'Weight From'], 'weight_to' => ['title' => 'Weight To'], 'econt_office' => ['title' => 'To Office Cost'], 'econt_door' => ['title' => 'To Door Cost'], ]; $this->addRowAction('edit'); $this->addRowAction('delete'); $this->fields_form = [ 'legend' => [ 'title' => 'Shipping Cost', 'icon' => 'icon-list-ul' ], 'input' => [ ['name'=>'weight_from','type'=>'text','label'=>'Weight From','required'=>true,], ['name'=>'weight_to','type'=>'text','label'=>'Weight To','required'=>true], ['name'=>'econt_office','type'=>'text','label'=>'To Office Cost','required'=>true], ['name'=>'econt_door','type'=>'text','label'=>'To Door Cost','required'=>true], ], 'submit' => [ 'title' => $this->trans('Save', [], 'Admin.Actions'), ] ]; } myclass class EcontShipping extends ObjectModel { public $id; public $weight_from; public $weight_to; public $econt_office; public $econt_door; public static $definition = [ 'table' => 'econt_shipping_cost', 'primary' => 'id', 'displayError' => 'true', 'fields' => [ 'weight_from' => ['type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required'=>true], 'weight_to' => ['type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required'=>true], 'econt_office' => ['type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required'=>true], 'econt_door' => ['type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required'=>true], ], ]; } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now