Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

form / field / default value overwrite

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



4.5k
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.



4.5k

Not at all!