Jump to content

Passwd field validation


Recommended Posts

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 by renaud2263 (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...