@dhony I think I got a good grasp on your problem. Here’s my take on how to solve this while still making code simple.
First of all, there’s two routes for links: :new and :create.
They look roughly like this:
get /orgs/:organization_id/new, YourController, :new
post /orgs/:organization_id, YourController, :create
Your org page should link to :new, where the form lives. The :create route doesn’t have any HTML, its just a “do things and redirect” kind of route.
Your :new route could look roughly like this:
def new(conn, %{"organization_id" => organization_id) do
changeset = YourContext.link_changeset(%{organization_id: organization_id})
# assign to conn and render here
end
And here’s the magic:
<.inputs_for :let={f} field={@whatever_assign}>
<.input type="hidden" field={f[:organization_id]} />
... your inputs here
</.inputs>
The hidden input will just work on this case.
Depending on your phoenix version the HTML will be different, in that case could you paste your form here?




















