I am playing with Symfony's form builder, and I can't find a way to not display a label. Further, I am interested in actually setting a placeholder for each input box. Is this possible? I have researched a bit and found nothing.
My form:
<form action="{{ path('searchPeople') }}" method="post" class="form-inline">
{{ form_errors(form) }}
{{ form_row(form.first_name) }}
{{ form_row(form.last_name) }}
{{ form_rest(form) }}
<br />
<button type="submit" class="btn btn-primary" /><i class="icon-search"></i>Search</button>
</form>
EDIT: Solved!
All of the solutions below helped, but I gave the answer to the primary helpful comment. I appreciate all of the help. For anyone else that comes across this, this is my final working code:
<form action="{{ path('searchPeople') }}" method="post" class="form-inline">
{{ form_errors(form) }}
{{ form_errors(form.first_name) }}
{{ form_widget(form.first_name, {'attr': {'placeholder': 'First Name'} }) }}
{{ form_errors(form.last_name) }}
{{ form_widget(form.last_name, {'attr': {'placeholder': 'Last Name'} }) }}
{{ form_rest(form) }}
<br />
<button type="submit" class="btn btn-primary" /><i class="icon-search icon-white"></i>Search</button>
</form>
question from:
https://stackoverflow.com/questions/16993684/symfony2-form-builder-remove-label-make-it-placeholder 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…