Inertia Form helper #538
Replies: 1 comment 2 replies
-
Hey @ninjaparade! While I don't entirely hate this idea (I believe we even considered it when designing the form helper initially (cc @reinink)), it kind of gives you two different APIs to do the same thing, as well as that it creates confusing possibilities without really giving you that much benefit. For instance, I can guarantee you that there's a few Inertia users out there who would definitely try obviously stupid stuff like this and complain on our issue tracker that it doesn't const form = Inertia.form({ 'name': null, 'brilliantIdea': true }, 'url': '/not-trash', 'method': 'post' })
form.get('/foo') Even more likely, they could try doing stuff like this, which is somewhat less-stupid but is still entirely valid syntax (methods and parameter-wise): const form = Inertia.form({ 'name': null, 'brilliantIdea': true })
form.submit() Finally, it adds a maintenance burden, as suddenly we'd have to support both syntaxes as far as changes/fixes/new features go, which will definitely limit us or could even create problems of their own at some point without really adding any new functionality. So, yeah, in conclusion, while I definitely appreciate the idea, I'm personally not in favour of supporting it. |
Beta Was this translation helpful? Give feedback.
-
Currently with the Inertia form helper, you are able to create a reactive data representation of your data that you would use to send to the server.
an example in Vue 3 below.
and then once you're ready to submit this form you call
so what if we could, rather than having to define the method and path for the form, when we submit, actually add that to the form object itself?
and then you can just magically call
I know what you're saying right now reading this, what a fantastic idea. Trust me I agree with you.
I think this would be awesome and well received by the Inertia community.
Thank you for your time, now a note from our creator.
Beta Was this translation helpful? Give feedback.
All reactions