Search code examples
symfonytwigsymfony-3.4twig-extensionsymfony3

symfony twig custom submit label form


I want to customize my form submit button label from "submit" to "Edit" in some of pages , and "submit" to "Add" in some other pages, with twig and Symfony 3.4 as this :

{{ form(form) }}
{{ form_widget(form.submit,{'label':'edit'}) }}

but this is not working for me :/ I see the documentation about all of that in the Symfony offcial website, but this didn't help me .

So can any one help me please?

thank you


Solution

  • Instead of form_widget, try form_row

    {{ form_row(form.submit, { 'label': 'edit' }) }}