Open danskarda opened 1 year ago
Sorry, I've not had time to look at this. I'm heavily using forms in RAD, and my guess is this is an oversight in the demo implementation. Forms must have explicit validators to do validation correctly, and when there are refs, you may also need to ensure that the edges are validated. My guess is that this particular case just wasn't coded fully.
When adding validation to subform's attributes I found strange behaviors:
The validations are simple
ao/required? true
defined on attribute level. Form subform relation isao/cardinality :many
As I investigated the issue and tried to narrow down a reproducible example
Replicate in recent fulcro-rad-demo@5e40e59 (Datomic version)
As you can see Line item was saved without an Item.
Interestingly, when you reopen the same item invoice, the missing value is marked as required
Are you able to reproduce same behavior with fulcro-rad-demo?
Some idea:
The
:event/save
handler uses result offs/completed-form-props
to feed validate function:https://github.com/fulcrologic/fulcro-rad/blob/9a8176203c948956fce2ccfc577ca167a5ff6182/src/main/com/fulcrologic/rad/form.cljc#L1292
After some poor's man debugging using js/console I found that proposed-form-props does not include new items. To be honest I have no clue why or what these functions are doing.
Thanks