AshPhoenix checkboxes acting wonky
My form (slightly abbreviated):
Change Handler
Form Creation (mount)
Resource Definition (Storefront)
Problem Description
Issue: When user checks the "Published" checkbox and then changes the dropdown (type field), the checkbox gets unchecked
automatically during form validation.
Observed in logs: The checkbox value shows up as "published" => "false" in form params even when it should be checked.
In general the checkbox acts super weird. Like on the create form I need to click it twice to check
Solution:Jump to solution
Had claude check my input components against a fresh phx.new core components and now it all works. Thank you for that (in hindsight) obvious place to look. I have been debugging like crazy lol.
7 Replies
Man an LLM is good at structuring a nicely condensed summary of my problem at least 😛
All newest versions of ash, ashphoenix etc
I cannot find anything specific about ashphoenix and checkboxes except for in nested forms (which I am not doing)
what do the params look like when you click the checkbox? what does the
input
FC look like for your checkbox?FC=?
ah field component
or function component
ahhh yes that was actually the pointer I needed
I have a bug in it!
I translated from core components to tailwind ui and I messed it up
meatsack bug even, not llm 😄
oops
Solution
Had claude check my input components against a fresh phx.new core components and now it all works. Thank you for that (in hindsight) obvious place to look. I have been debugging like crazy lol.