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

form / field / default value overwrite

Hello everyone. How can i force form field to don't use data incoming from post in default value?



11.1k
Accepted
answer
edited May '16

Hello! If I understand you right, and you whant to clear field with post, you can use the $field->clear(); method. You can do it like this:

$password = new Password('password', [
    'minlength'   => 3,
    'placeholder' => 'Password'
]);
$password->addValidator(new StringLength([
    'messageMinimum' => 'Your password must be longer than 3 characters.',
    'min'            => 3
]));
$password->clear(); // This

Good luck!

It's correct solution for my problem. Thank you so much.



11.1k

Not at all!