Send empty map for empty `inputs_for` fields

I have a form that contains inputs_for

when there is none, I want the form to send empty map like

field: %{}

instead of not sending anything at all

That’s not possible. Forms encode values either as application/x-www-form-urlencoded (default) or multipart/form-data, both of which cannot encode empty list and even less empty map. They’re basically just key-value formats, where the values are strings and there a few conventions around the setup of keys to make it seem data is nested.

1 Like