mogadget
Nested form using inputs_for is not rendering
I have a relationship User has_one Profile. In my User
defmodule Cal.Accounts.User do
actions do
defaults [:read]
create :create_user_with_profile do
argument :profile, :map do
allow_nil? false
end
change manage_relationship(:profile, type: :create)
end
action
relationship do
has_one :profile, Cal.Accounts.Profile do
destination_attribute :user_profile_id
end
end
...
end
In my form liveview
def mount(_params, _session, socket) do
form = Cal.Accounts.form_to_create_user_with_profile()
socket =
socket
|> assign(:form, to_form(form))
|> assign(:page_title, "New User with Profile")
{:ok, socket}
end
def render(assigns) do
...
<h4>User</h4>
<.input field={form[:email]} label="Email" />
<.input field={form[:user_name]} label="Name" />
<.input field={form[:timezone]} label="Timezone" />
<h4>User Profile</h4>
<.inputs_for :let={form_profile} field={@form[:profile]}>
<.input field={form_profile[:title]} label="Title" />
<.input field={form_profile[:location]} label="Location" />
</.inputs_for>
end
The form renders the Email, Name and Timezone but the fields for profile Title and Location are not
First Post!
cmo
Throw a few inspects in there to see what data you’re getting in render. IIRC <prev>{inspect(@form[:profile], pretty: true)}</pre>.
0
Last Post!
cmo
Popular in Questions
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
Other popular topics
Hello, how can I check the Phoenix version ?
Thanks !
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









