Form, get passed values if one field failed

I have a form:

name1 = a

name2 = b

date = sdfsdf

"date" is obviously bad, so ->isValid() will fail. But name1, name2 is ok. How to get their values? I only can see their "default" value



12.2k

so, in other words: while adding form elements, I want something like that:

$item = new \CoreExt\Form\Element\Text('name');

$item->setDefault($item->getValue());

You don't need to do antyhing. Phalcon handles this for you:

{{ form.label('names') }}
{{ form.render('names') }}
{{ form.messages('names') }}

The above code will generate the input, its label, will print errors and will auto populate input on form fail.

More info from the docs: https://docs.phalconphp.com/en/latest/reference/forms.html