Home United States USA — software Vue.js and Symfony Forms

Vue.js and Symfony Forms

246
0
SHARE

How can I render forms in Vue.js and handle them in Symfony? While I can quit rendering the forms like Twig handles it — I definitely want to keep the Form …
Join the DZone community and get the full member experience. Symfony provides us the symfony/form package which makes the handling of rendering and submitting forms easier than ever. Soon this will become even easier with the new “ Form handler helper ”, but that’s not the point here. What annoyed me when I first started working with Vue.js was the fact that I pretty much like the need to say “ goodbye ” to the forms rendering directly in the Twig ( which is very handy). I’ve started searching for some “ form generators ” packages for Vue.js. There are a few, but so far I didn’t like any of them. In the worst case, I could just render the form in some kind of API method like /get-form-view but this is so against the Vue.js workflow/concept. So… I started to ask myself and think: “ How can I render forms in Vue.js and handle them in Symfony? While I can quit rendering the forms like Twig handles it — I definitely want to keep the Form validations/handling provided by Symfony. ” There are few problems that need to be solved here: By default, each Form created with symfony/form packages have the CSRF Token validation turned on.

Continue reading...