Forms - Working with Vue

william - 2 weeks ago

Hi! My question is basically what the recommended approach is when using vue, forms and pyro. I am guessing the only way we can use forms in vue, is to add the form and field markup manually. Fine, so then where should we send the form after front end validation and how to specify the handler when using forms module? Do we add our own route for this?

Answer

william - 2 weeks ago

Fixed

william - 2 weeks ago

--

william - 2 weeks ago

Fixed

ryanthompson - 2 weeks ago

You should be able to define the handler in the Twig portion if custom and leave the routing / post action alone. Ya?

william - 2 weeks ago

There are probably many ways to do this. However i ended up going with :

{% set form = form('review').get() %}
<review url='{{form.object.options.url}}'></review>

What i didn't understand directly was that the url here is the key to everything with the parameters cached. Not sure why i missed it or if it's not really documented.

Another way, would be to just use slots. Then you don't need to build up the form yourself. But doing so, you gotta have jquery. If you go this road, i would probably open and close the form in the vue template. And then put the slot in between, making sure you can add event handlers to your form.