#Validate dropdown

1 messages · Page 1 of 1 (latest)

alpine badge
#

I want to allow users to change dropdown fields only if some other input fields are entered.
Is there any validation that can be done here. onOptionChange wont allow to have validations, irrespective of the option change it will allow users to change.

alpine badge
#

Also can I assign a value like this dropdown1.selectedOptionValue ='xyz'

#

eventhough it allows me to do. It wont get reflected in the frontend

#

@elder whale

gritty beacon
# alpine badge Also can I assign a value like this ```dropdown1.selectedOptionValue ='xyz'```

Hey you cannot directly assign values to variables, it won't trigger a change. Store a value in the appsmith store and then use that value in the selectedOptionValue like {{appsmith.store.dropdownValue}}. Please check this video it will help - https://www.youtube.com/watch?v=UUvJn8oWqNs

The Appsmith store provides a simple interface to save data in key-value pairs with an API similar to the browser’s localStorage. This video shows how to interact with the store using the storeValue function 🏬

Learn more about using the storeValue function https://docs.appsmith.com/framework-reference/store-value

Next steps
• Learn how to dyna...

▶ Play video
alpine badge
#

Hey I already have a default value

#

@gritty beacon

#

So this works dropdown.selectedOptionValue ={{appsmith.store.dropdownValue}}?