carlgleisner

carlgleisner

Checking used_input?/1 on inputs_for/1?

In LiveView 1.0 (1.0.0-rc.7), I am using inputs_for/1 to render forms for a nested Ash resource and it’s working great with validation of the fields in the nested resource as well as validation of the attribute with the array of the resources itself.

So, I am able to show the error below the inputs_for/1 component. However, I’m unable to immediately use used_input?/1 in order to delay showing this error until the field of the attribute for the nested resource should be considered used, after submission in this case I would like to think.

Notably, the params do not include any entry for _unused_addresses which would have caused used_input?/1 to work.

  • Is there an “idiomatic” way to handle this?
  • Am I holding it wrong?

The attribute in question

attribute :addresses, {:array, MyApp.MyDomain.PostalAddress},
      allow_nil?: false,
      public?: true

The field in the form

<.inputs_for :let={address_form} field={@form[:addresses]}>

Thank you in advance for any insights :pray:

Most Liked

zachdaniel

zachdaniel

Creator of Ash

I believe this is fixed in main of Phoenix live view but not released yet.

carlgleisner

carlgleisner

Retracting this last reply and investigating, sorry :slight_smile:

zachdaniel

zachdaniel

Creator of Ash

Since a lot of different things could be going on here, I think that the best thing to do here would be to make a reproduction.

Where Next?

Popular in Questions Top

rms.mrcs
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
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New

Other popular topics Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement