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

How to force $form->render() to use Entity values instead of $_POST data?

It seems, when you call $form->render("name"), the following hierarchy is used for choosing which value to print: Default value < Entity value < $_POST value.

I need to change that. How? For specific form (or even for a specific form element) I want it to be: Default value < Entity value, ignoring $_POST data.

Reason is, I have X forms in a page and every form has a fields with exact same name, for example "phone". When I just render forms and there's no $_POST data - there are no issues, because Entity value is used for each form's "phone" field.

But when I submit FormB for example, there is $_POST data and all forms pick new value for FormB "phone". Suddenly, each forms thinks it is the one being submitted and for "phone" prints data from $_POST and I want them to keep values from Entities, and only the submitted form should use values from $_POST.

Did not work.

Submitting Form2 with field "name" value "NewName" forces Form1's field "name" be pre-filled with "NewName" although it's entity has something completely different. Tried setting option 'edit' to true and false in all possible combinations