I have a User resource with has_many roles.
The role has a time_period field, so when I show the array of roles using input_for, each role has a dropdown/select for the time_period.
When the user changes a role’s time_period I want to adjust 2 other fields of that role.
I am isolating the handle_event for when that time_period select changes. But from there, I don’t know what to do in the handle_event to change other fields, and have that reflected in the AshForm as well as in the UI.
Changing the params
of the handle_event to have the data I want, and passing that into AshPhoenix.Form.validate(user_form, params)
does nothing.
I tried using AshPhoenix.Form.update_form
with a path to the role, but it isn’t clear what do in the function you supply.
Also, sometimes they might be editing an existing role from the db, or a new role.
Thank you!