This is almost everywhere. For example, I need to pick a fruit from a list of fruits from a dropdown. And the last option on that dropdown is "Other", by selecting that another text field appears to allow users to type their favorite food.
Assuming all the data comes from database, what would be the best way to implement it on the front-end?
Right now, what I can think of is giving the "Other" option a special Id in database, and checking against that in UI. Which means saving database Id in my front-end code.
The other option is just checking for the "Other" text. Which seems ugly too.
Is there any better approach to this problem?