Hi! I’m trying to configure form field dependencies in my model, but I don’t know how to do it correctly.
I’ve got 3 fields:
linked_items:
label: Use items from another post
emptyOption: "-"
type: dropdown
options:
1: Post with id 1
3: Post with id 3
4: Post with id 4
import_items:
label: Load items of the selected post into this post
type: switch
items:
label: Items
type: repeater
- If the
linked_items
field is empty, theimport_items
field should be disabled and its value changed to 0. - If the
linked_items
field is not empty and theimport_items
field is checked, theitems
field value must be copied from the linked record to the current record. - After import, the
import_items
field should be unchecked and disabled, and the value of thelinked_items
field should be set to empty option. - The value of the
import_items
field should not be saved in the database (purgeable).
All of this should be executed dynamically, immediately after interaction with the fields. I tried using dependsOn
and trigger
, but it didn’t work. It created an infinite loop of refreshing fields.
Any idea how to do it correctly?