You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding validation to subform's attributes I found strange behaviors:
I was able to save forms with invalid subforms (fulcro-rad-demo)
After clicking Save nothing happened, because backend db enforced the constrain. Front-end validation passed and it did nor warned that save have not succeeded (sql backend enforced constrains)
When multiple fields were invalid only some of them were marked as invalid. After fixing these fields, previously unreported invalid fields become highlighted
Validations on subforms were triggered only when some toplevel attribute become invalid
The validations are simple ao/required? true defined on attribute level. Form subform relation is ao/cardinality :many
As I investigated the issue and tried to narrow down a reproducible example
the issue is not caused by compilation, caches and schadow-cljs reload (defattrs are in .cljc files)
the issue is not caused by custom UISM nor validator
the issue persists with much simpler form (Account with two 1:n subforms User and Credential, both subforms with required fields)
finally I was able to replicate the issue (or similar) with fulcro-rad-demo
Replicate in recent fulcro-rad-demo@5e40e59 (Datomic version)
open the app
Invoices > View All
Select any invoice
Add a Line Item
Set quantity
Click save
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 of fs/completed-form-props to feed validate function:
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
The text was updated successfully, but these errors were encountered:
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:fulcro-rad/src/main/com/fulcrologic/rad/form.cljc
Line 1292 in 9a81762
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
The text was updated successfully, but these errors were encountered: