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

Iterating over forms in phalcon

I can't find a category called "forms" so I will post this in "Internals".

Following scenario: I have to build a scaffolding solution for an admin interface. Now I am stuck at the form generation:

{% block content %}
 {{ form('/admin/' ~ controller ~ '/add', 'class': 'ui form') }}
    {% for element in form %}
        <div class="field">
            {{ element }}
    {% endfor %}
{% endblock %}

This works quiet well. But I can't find a solution to render the associated field label. So I need a way to iterate over a form and print out the labels, error messages and so on.

Maybe there is already a solution within this forum. I can't find any. Any ideas?


Thank you, that's exactly what I am searching for!