renaud2263 Posted October 16, 2018 Share Posted October 16, 2018 (edited) Hi, In my custom module I have to controllers, admin and front, and a class with objectModel (it's similar of customer subscription). Then in the templates I have a field called "passwd". In the class definition field: 'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'required' => true, 'size' =>60) All is perfect in the front side and an error is displaying when user don't fill the field. But in the admin side, when I edit and valid a modification, the error also displays: "Property MyClass->passwd is empty" In the controller renderForm, i have: array( 'type' => 'password', 'label' => $this->trans('Password', array(), 'Admin.Global'), 'name' => 'passwd', 'required' => ($obj->id ? false : true), 'col' => '4', 'hint' => ($obj->id ? $this->trans('Leave this field blank if there\'s no change.', array(), 'Admin.Orderscustomers.Help') : $this->trans('Password should be at least %length% characters long.', array('%length%' => Validate::PASSWORD_LENGTH), 'Admin.Orderscustomers.Help')) ), That means if I am in modification mode, the object->id is here and no need to fill passwd field, isnt't it ? The proof is the hint which shows "leve this field blank..." So what can I do with this field ? Thanks for help. PS: I also tried to change the def field and set required=>false, but in this case, when I edit the member the passwd is not loaded in the field and and the database field is empty after saving changes... Edited October 16, 2018 by renaud2263 (see edit history) Link to comment Share on other sites More sharing options...
renaud2263 Posted October 17, 2018 Author Share Posted October 17, 2018 In fact I just want to have the same behavior of AdminCustomerController: when we edit a customer, we can let the passord field empty and it's not modified in the database. I don't find how it is made. Help ? Link to comment Share on other sites More sharing options...
renaud2263 Posted October 19, 2018 Author Share Posted October 19, 2018 No idea ? 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