Help with Setting Default Value in Drop-Down List Based on Autocomplete
Hi there,
I have a drop-down list that depends on the selected value from an autocomplete field on the same form. I'm able to populate the drop-down with sorted query results based on the autocomplete selection, but I'm having trouble setting the default selected value to the first valid item in the list.
Even after updating the autocomplete field, the drop-down continues to display the placeholder text rather than the first item, despite setting the selected index in the object. I've also tried using the Set Current Form Element Item activity, but it didn’t resolve the issue.
Ultimately, I want to avoid a scenario where users skip selecting a value from the drop-down and simply click the search button. In those cases, the drop-down value ends up being undefined, and I'm unsure how to catch that using an If activity or similar logic.
Any guidance or suggestions would be greatly appreciated. Thanks in advance!
Best regards
-
Hi Andrew Kan, thank you for your post! Based on what you've described, you may be able to get the behaviour you're after by toggling on the “Required” checkbox for your Drop Down List element and enabling the “Causes Validation” option on your search button. This will show a validation error to the user if they click the search button without selecting anything from the dropdown.
0 -
Hi Alisa,
Thanks, your suggestion worked perfectly for validating the required entry. Definitely a newbie oversight on my part!
As a follow-up, if I wanted to avoid using placeholder text and instead automatically set the drop-down list to the first item based on the autocomplete selection, how would I go about doing that?
Appreciate your help!
Best regards
0 -
Hi Andrew Kan,
As it stands, the “Selected Index” property on the Drop Down List element only works for manually configured form element items. Since you are setting the items dynamically in this case, it would be better to use the Set Current Form Element Item activity in your Drop Down List element's Options subworkflow (i.e. the subworkflow that supplies the dropdown with items).
I've left a note to our developers to see if we might extend the functionality of the “Selected Index” property in the future and/or clarify its current limitations.
I hope that helps! If not, please feel free to open a support ticket with us.
0 -
Thanks for the help Alisa!
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
4 kommentarer