On 28.11.2010, at 16:49, Lukas Kahwe Smith wrote:
>
> On 28.11.2010, at 00:17, Lukas Kahwe Smith wrote:
>
>> Hi,
>>
>> I am trying to resync my symfony fork to the current state and I am running
>> into issues with my custom form.twig.
>> Right now I have the following:
>>
>> {% extends "TwigBundle::form.twig" %}
>>
>> {% block group %}
>> {{ group|render_errors }}
>> <ul>
>> {% for field in group %}
>> {% if not field.ishidden %}
>> {{ field|render }}
>> {% endif %}
>> {% endfor %}
>> </ul>
>> {{ group|render_hidden }}
>> {% endblock group %}
>>
>> {% block field %}
>> <li {% if field.hasErrors %} class="form_error" {% endif %}>
>> {{ field|render_label }}
>> {{ field|render_errors }}
>> {% if field.hasErrors %}
>> {{ field|render_widget(['class':'form_error']) }}
>> {% else %}
>> {{ field|render_widget }}
>> {% endif %}
>> </li>
>> {% endblock field %}
>
FYI my solution for now is the following:
{% form_theme form form.getOption('theme') %}
<form action="{% path 'doctrine_user_user_create' %}" {{ form|render_enctype }}
method="POST" class="doctrine_user_user_new">
<ul>
{% for field in form.getAllVisibleFields() %}
<li{% if field.hasErrors %} class="form_error" {% endif %}>
{{ field|render_label }}
{{ field|render_errors }}
{{ field|render }}
</li>
{% endfor %}
<li>
<input type="submit" value="{% trans 'Create user' from
'DoctrineUserBundle' %}" />
</li>
</ul>
{{ form|render_hidden }}
</form>
Of course this means that I have to repeat "<li{% if field.hasErrors %}
class="form_error" {% endif %}>" in every template.
regards,
Lukas Kahwe Smith
[email protected]
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en