We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to set a different value to a variable in the form at the time of rendering

this is my code....

{% for element in form %}
            {% if is_a(element, 'Phalcon\Forms\Element\Hidden') %}
                {{ element }}
            {% else %}
                <div class="form-group">

{% if element.getName() == "name" %}

                    {{ element.label() }}
                    {{ toedit.type_name }}

{% else %}

                    {{ element.label() }}
                    {{ element.render(['class': 'form-control']) }}
{% endif %}

                </div>
            {% endif %}

when the element.getName()=="name"; i want to set different value in the form rather than rendering it.......how to do this????

edited Oct '16

This should happen imho in form class. Not in volt. Or even in controller change value of entity/array.