Custom select and input box: Unable to select the newly added entry

Hi,

I have two components on a modal:

  1. A custom select that fetches the options from a ServerConnect
  2. An input box that is used to add a new option to the select:

    When I fill the new option box and click on the + icon: A form inserts the new option in the database and on success it reloads the ServerConnect of the Custom Select

This part is working well, however I need to programmatically select the newly added option in the custom select. For this to happen, I tried to do the following on the success of the load of the ServerConnect that fetches the Select options:

modal_1.form_2.select_new_option.setValue(form_1.data.insert1.identity);

However this last part did not work and nothing is selected. I tried instead to add a button in the modal and have the above action on click and that worked well

What is the best way in order to set the custom select to the recently added option without having to press an additional button?

Thank you

Community Page
Last updated: