bennydreamtech23
please i would like to understand how to implement cast_assoc form for has many relationship using inputs_for for the nested relationship but currently only working for has_one and not implementing for has_many relatiosnhip, when it comes to has many only the main field showing not the associated field:
This is the html aspect of my code:
<%= form_for @payment_changeset, "#", [phx_submit: :create_payment, phx_change: :validate_payment_entry, phx_target: @myself, id: "capture_account_info"], fn f -> %>
<div class="border border-gray-300 rounded-lg p-6 bg-white shadow-md">
<div class="manual-entry-css">
<div class="flex md:flex-row flex-col items-center justify-between gap-4">
<%= inputs_for f, :beneficiaries, fn b_changeset -> %>
<div class="py-3">
<%= select(
b_changeset,
:bank_id,
Enum.map(@bank_names, &{&1.bank_name, &1.id}),
required: true,
class: "focus:outline-0 px-4 py-2 rounded-l-md w-full border form-control",
phx_update: :ignore
) %>
<%= hidden_input(b_changeset, :bank_location, value: "local") %>
</div>
<div class="py-3">
<%= text_input(b_changeset, :account_number,
required: true,
class: "w-full form-control",
placeholder: " Account Number"
) %>
<p class="block ">
<%= error_tag(b_changeset, :account_number) %>
</p>
</div>
<% end %>
<div class="py-3">
<%= text_input(
f,
:balance,
class: "w-full form-control",
placeholder: "Amount",
required: true
) %>
</div>
</div>
</div>
<div class="flex items-end justify-end lg:mt-2 mt-4">
<button phx-target={@myself} type="submit" class="btn-primary rounded-sm">
Add
</button>
</div>
</div>
<% end %>
</div>
<% end %>
please i need help with fixing this problem
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











First Post!- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
bennydreamtech23
Please am stll facing the issue
Most Liked
benwilson512
Hi @bennydreamtech23 can you provide more information? What is the main schema you are operating with? What is the
has_manyrelationship you want to create? What have you tried so far?LostKobrakai
Multiple options. I’d suggest the first one, unless that doesn’t work for some reason in your usecase:
The second one can still be educational nontheless.
bennydreamtech23
Thank you, i will check them out and give feedback once i am done