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_itemsfield is empty, theimport_itemsfield should be disabled and its value changed to 0. - If the
linked_itemsfield is not empty and theimport_itemsfield is checked, theitemsfield value must be copied from the linked record to the current record. - After import, the
import_itemsfield should be unchecked and disabled, and the value of thelinked_itemsfield should be set to empty option. - The value of the
import_itemsfield 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?