Skip to content

How to render a Tabler submit button #23

Answered by cavasinf
cavasinf asked this question in Q&A
Discussion options

You must be logged in to vote

Reply for #23 (reply in thread) to summarize.

We have two possible ways to create a button from Symfony

Controller render

⚠️ Only used when MULTIPLE submit buttons ⚠️

You can create button from Symfony form via SubmitType:

$form = $this->createForm(PostType::class, $post)
            ->add('saveAndCreateNew', SubmitType::class);

And check in controller if used by:

$form->get('saveAndCreateNew')->isClicked()

It will be rendered from Twig via form_row() or form_widget().

Everything is fine today because it is already implemented in TablerBundle ✔️

HTML/Twig render

When using ONE submit button, Symfony recommend to create it from raw HTML.

In our case, we have:

  • Macro that can render fake …

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

cavasinf
Dec 14, 2021
Collaborator Author

You must be logged in to vote
0 replies
Comment options

cavasinf
Dec 14, 2021
Collaborator Author

You must be logged in to vote
1 reply
@kevinpapst
Comment options

Comment options

cavasinf
Dec 16, 2021
Collaborator Author

You must be logged in to vote
2 replies
@kevinpapst
Comment options

@cavasinf
Comment options

cavasinf Dec 16, 2021
Collaborator Author

Answer selected by cavasinf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants