Create Ui-component field dependency

While you would like to have form field dependency. That trick may help you regarding show / hide field depend another field.

I have field “filter_type” with options “fillter by date” and “fillter by Increment Id” . So, I would like to show field date when I select “filter by date” and hide Increment Id or opposite

Firstly, create form field via your component:

You will use “from_date” and “to_date” fillter date. Element “visibleValue” is custom and you should adjustment via js.
Create file js via your module. …/web/js/form/element/options.js
You will see function initialize() will run after loading this file. I set delay 1 second because something js load slow and make element can’t load finished. Function fieldDepend() will process field depend show/hide via your field component Function onUpdate() will run when your component has an update

Leave a Reply