Hello everybody,
I wrote some draft about a new twig block for forms ({% form %}). Aim is to
handle enctype, no-validate and so on for forms.
Aim is to be able to specify application-level form behaviors (no-validate,
no-autocompletion). I would like to know your opinion about that, do you
think such helpers should be part of Symfony2?
Thank you for feedback,
Alexandre
New form functionsPresentation
Automatically render the form. You can render manually form tag inner:
{% form(form, 'POST' url) %}
<h2>Form title</h2>
{{ form_widget(form) }}
<p><input type="submit" value="Submit" /></p>
{% endform %}
Render form automatically
Only specify submit button:
{% form(form, 'POST', url) footer %}
<div class="promote">
<label>You're one step far from registering!</label>
<input type="submit" value="Register!" />
</div>
{% endform %}
Extra attributes
{% form(form, 'POST', 'url', {id: 'post_edit', class: 'post-edit-form'}) footer
%}
{# ... #}
{% endform %}
Disable HTML5 validation
Disable on application can be achieved via container configuration (see
below)
You can disable on runtime with no-validate option:
{% form(form, 'POST', url) no-validate %}
Disable HTML5 autocomplete
Disable on application can be achieved via container configuration (see
below)
You can disable on runtime with no-autocomplete option:
{% form(form, 'POST', url) no-autocomplete %}
Container configuration
framework:
form:
html5_validate: true
html5_autocomplete: true
--
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