We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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


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

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


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.phalcon.io/en/latest/reference/forms.html