Drab: remote controlled frontend framework for Phoenix

Are you talking about what the user is actively typing? Or the data ‘you’ sent to the form?

2 Likes

Either, but I am specifically trying to add and remove nested forms for a has_many schema. Full details on this post: Poking and peeking form data

2 Likes

Never mind, it was there all along in @changeset. I was thrown by IO.inspect not printing the nested structs recursively.

1 Like

After playing around some more, I now want to get the data the user has entered to the form. Is this possible?

See the Drab page: https://tg.pl/drab#simple. Is this what you wanted to do?

3 Likes

Yep the drab page shows how to get information from the DOM, it’s very doable. :slight_smile:

2 Likes

Not quite. That example is setting an assign instead of directly manipulating the DOM. It looks like Drab.Element has what I am after.

1 Like

The Simple example is getting the full contents of the form sent back to the server. Element tends to involve another round-trip, which adds a bit of latency, but if it’s fine for some use cases. You can then set DOM values directly using Element of course, but you asked how to get the data from the DOM. :slight_smile:

2 Likes

Oh, I completely misunderstood that example, then. I’ll go over it again now. Thanks!

2 Likes