I have an app I created with the Generator and the Generated code is used as a convenient way to interact with the database . The rest of the app is a Live View app where most of my code is in a single page with a render method spitting out the HTML
The code created with the Generators abstracts the relationship between forms, controllers in a way that I can’t follow.
I have no idea how the controller code is being triggered when this form submits.
<.simple_form :let={f} for={@changeset} action={@action}>
<.error :if={@changeset.action}>
Oops, something went wrong! Please check the errors below.
</.error>
<.input field={f[:name]} type="text" label="Name" />
<.input field={f[:version]} type="text" label="Version" />
<.input field={f[:owner]} type="text" label="Owner" />
<.input field={f[:note]} type="textarea" label="Note" />
<.input field={f[:developer]} type="text" label="Developer" />
<.input field={f[:status]} type="text" label="Status" />
<.input field={f[:url]} type="text" label="Url" />
<.input field={f[:manager]} type="text" label="Manager" />
<.input field={f[:db_backup]} type="checkbox" label="DB Backup" />
<.input field={f[:vnetc_auto_upgrade]} type="checkbox" label="vNetC Auto Upgrade" />
<.input field={f[:firmware_auto_upgrade]} type="checkbox" label="Firmware Auto Upgrade" />
<.input field={f[:managed_out_of_service]} type="checkbox" label="Managed Out of Service" />
<:actions>
<.button>Save Test bed</.button>
</:actions>
</.simple_form>
I am not looking for the answer to this right now, in this post.
In my Live view code, I wrote the the relationships between event handlers and forms and is easy to understand. In the “generated” forms I can’t follow it at all.
I want to know if there is a tutorial where the Generator is used to create TODOS (or whatever) and the writer/speaker backtracks through the edit form and explains the control flow. I assume the Generators use “Best practices” (or at least better than bad) so it might be a good thing to understand them and why the edit form is written this way. I’m asking for this style because it’s direct.
If there isn’t a tutorial of this kind then I’ll put it in my que and make it myself once I know enough to create it.
Thank you.