Open rmoorman opened 3 months ago
The issue is in the generated simple_form:
You can see it sets the default of @as
to nil. You can change it in your app, I will migrate this to the Phoenix repo.
Thank you @josevalim for having a look!
I suppose the suggestion of using as
is about working around the problem by adding as={@form.name}
or something like that within render/1
? (which does indeed work)
And if there is anything else I can do to help moving this forward, please let me know.
While using the
simple_form
component (that is generated by default usingmix phx.new
), the following problem grabbed my attention. I was building a form schema inside a live view and wanted to render that form using thesimple_form
component.The example states that it should be used like this
But I thought, that it would be more consistent to use the
<.simple_form :let={f} for={@form}>
in my case (because I was likely to also useinputs_for
in that project). But using:let
does cause the structf
to containnil
as it's name, which in turn messes up the field names and value groupings of the form (as the prefix based on the schema name is missing).Currently, the following code:
produces the following results
Which seems odd to me.
I prepared an example repository that can be used to reproduce the issue.