hannes
AEAsh Elixir
•Created by hannes on 2/5/2023 in #support
Calculations and AshPhoenix.Form
First post! So thanks @Zach Daniel for this awesome library. Looks really promising!
I'm working on a side project where I have to store employee contracts. For each contract I store the employment (as factor between 0 and 1) and the number of vacation days per year (when working full time).
I'm using
AshPhoenix.Form.for_action()
and LiveView to create a form (see screenshot) where the user can enter the employment as percentage (argument emp_percent
) and the number of vacation days (attribute vac_days
) and the hint should show the calculated effective vacation days based on the employment factor.
I'm already validating the form on change but I would like vac_days_eff
to be recalculated each time (so I can show it in the hint below the field). I might also be a bit confused about action attributes/arguments. Could this be solved using a private action argument?12 replies