Category: Configuration
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

The Select Widget's Default Value Showed Up in Modal but Not Triggering the Onoptionchange Event

Issue

I have a problem where the option change event in my dropdownlist in the modal doesn't trigger another query until I manually change the option. I tried searching for a solution in the community but couldn't find one. I'm wondering if there's a workaround for my case.

Resolution

The issue was that the onOptionChange event in a Select widget is not triggering when the default value is set programmatically. The solution is to either run the query right after setting the default value or trigger it from where the modal is being opened.

To implement this solution, code can be added to the table onRowSelected event. When the showModal function is called to open the modal, a chain of queries can be run using the .then() method. The code would look something like this:

{{showModal(‘modal_upd_xxx’)
.then(()=> query_upd_1.run())
.then(()=> query_upd_2.run())
.then(()=> query_upd_3.run())
}}

This will ensure that the queries are executed when the modal is opened, even if the default value in the Select widget was set programmatically.