Cocoon like library for Phoenix to manage nested forms?

Or alternatively some tutorial on creating dynamic nested forms in Phoenix, thank you.

I thought the HTML5 spec does not allow for nested forms?!? Whaaaa? o.O

1 Like

It’s not actually nested forms… but a bunch of js black magic in such a way it dinamically add more fields to a form that represents a has_many relation.

Well on the server side isn’t that just the inputs_for/4 in Phoenix.Html.Form? Just Enum.map with that…

Although no clue what that has to do with Phoenix if talking about the client-side, use whatever you want to there (or pass it back to the server and back again using Drab or Unpoly.js or whatever too), the front-end is back-end agnostic so no clue what a ruby thing would be all about. ^.^;

1 Like

Try VueJs. Dynamic forms are effortless, and sending data to the sever as json is trivial

1 Like

Exactly! Front-end is agnostic towards the back-end. ^.^

1 Like

I have not found any tutorial on dynamic forms with Vue.js yet, maybe you have some resource to share on the topic or an example app. Thanks.

Does formex do what you want? Here is an example of a collection of forms.

2 Likes

Yeah… I was just explaining what the gem does.

Why doesn’t people suggest Elm… it’s functional, it’s beautiful, and has all the original ideas people from Vue.js and Redux inspired from… :cry: :cry::cry:

1 Like

Because it’s hard to interoperate with Javascript libraries and VueJS comes with with ready-to use components you can just import from NPM (some of which might be quite compelx and tedious to implement on your own).

2 Likes

JS interop is pretty straight foward, it’s just another subscription thing like doing a http request… the difference is that instead of creating decoders you create ports… but anyway, i was just whining about it. :stuck_out_tongue:

I dont wanna digress that much on the matter, but I hope someday people will value the safeties Elm provides than “speed on finishing” things