How to Retrieve selected Dropdown value in UI Builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 01:07 PM
Hi, I created a custom Dropdown component on UI Builder and the dropdown component has three value for user to choose.
Dropdown:
value 1
value 2
value 3
How do i retrieve the value selected by user?
Example: I used this command to retrieve the value entered in a text area: event.payload.fieldValue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2022 07:24 AM
Did you solve this one? I'm also looking for the same, Please let me know if you find the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2022 11:05 PM
Found the solution, You need to create a client state parameter. In the event handlers, Click on Add an event handler and select 'Update Client state parameter' in the options. Now select the client state parameter you added in the first field. In the second field, you need to get the value of the selected drop-down value: Type "@payload.value " in the field and click on add.
In order to pass this value to the system, You need to create a data source and call the data source in the client script
'selectedValue' is my client state parameter, I'm passing the selected dropdown value to the shortdescription
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2023 10:07 AM
Hey Sai,
That was really helpful. I used " const input = api.state.selectedValue[0]; " to get the selected dropdown option value in client script. I used it to sort columns in table. However its working fine in Safari Browser, But in chrome its not working properly. Columns are not getting sorted out in ascending /descending order.
Is there any way we can use the method which will work in any browser to fetch the array data??