We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Prevent assign form field value

Hi all

Small issue: When I create a From for update, and assign User entity, Form loads password from model to field value. How to prevent this behavior?

    public function initialize($entity, $options)
    {
        parent::initialize($entity, $options);

        $password = new Password('password', [
            'autocomplete' => 'off',
            'class'        => 'form-control',
            'maxlength'    => 32,
            'value'        => '' // I need do this?
        ]);

        $password->setLabel('Password');
        $password->setDefault(''); // I need do this?
        $password->setUserOption('value', ''); // I need do this?

        $this->add($password);
    }

Thanks.



39.2k
Accepted
answer

Solved:

$password->clear();