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 %}


here is the template:
<form action="{% path 'doctrine_user_user_create' %}" {{ form|render_enctype }} 
method="POST" class="doctrine_user_user_new">
    <ul>
        {% for field in form.getAllVisibleFields() %}
            {{ field|render_label }}
            {{ field|render_errors }}
            {{ field|render }}
        {% endfor %}
        <li>
            <input type="submit" value="{% trans 'Create user' from 
'DoctrineUserBundle' %}" />
        </li>
    </ul>
    {{ form|render_hidden }}
</form>

I guess there are two issues here, addressing one of them would solve my issue 
in a clean way aka without having to redefine every field_* block:
1) there is no generic field block anymore
2) using field_group to do the rendering doesnt work, since i also need to add 
the submit buttons, which i cannot do in the templates

Of course I can also just rewrite my css to work with the default <div> 
approach, but I think the form layer needs to be flexible enough to handle this 
use case.

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

Reply via email to