How do you get the selected visible text of the dropdown when the chosen value differs?
If I am showing a list of products with their respective IDs in the value field. Now, if the user selects a product, the corresponding ID is passed to the database to save it. All good here.
However, on saving, I am sending a WhatsApp message confirming what the user purchased, so I can't send him the ID. I need to send the text of the product. However, the widget state of the dropdown gives me the selected value and not the text.
What is the easiest way to get the selected visible text and use it in my message on a button click? Chat GPT is giving complicated methods but it has no clue that Version 5 is out. So, I wonder if there is an easier way as this is an important use case in most apps?
Please give me your thoughts, ideas or solutions.