Reputation: 7209
This is my button which should be just icon without text
{{ form_widget(form.submit, { 'attr': {'class': 'fa fa-search'} }) }}
I tried also to set value in FormType
->add('submit', 'submit', array(
'label' => '',
'attr' => array(
'value' => ''
)
))
But nothing happen, or to say better, button contain
Submit
default text
Upvotes: 1
Views: 1677
Reputation: 1234
You could try to use "space" for label attribute value. It's not "fair" way, as your button still has one "space", but i used to use it:
{{ form_widget(form.submit, {
'label' : ' ',
'attr': {
'class': 'fa fa-search'}
})
}}
Upvotes: 2
Reputation: 1490
Try this to set the label to false:
->add('submit', 'submit', array(
'label' => false,
'attr' => array(
'value' => ''
)
))
Upvotes: 1
Reputation: 41
You can replace:
{{ form_widget(form.submit, { 'attr': {'class': 'fa fa-search'} }) }}
by:
<button class="fa fa-search"></button>
And don't add the submit button by code.
Upvotes: -1