PricingBlog

If I do not select a value in a dropdown assuming the first value will be selected by default

  • prettycold_-1279775892067061762

    Sam B

    1 year ago

    I have a dropdown in my screen. I did not give "Choose something" as a first value. Instead gave my 3 actual values. I've written change event on select and I'm able to pass the selected value if only I manually select a value, even the first one.

    Is there any way where the first value is passed by default. I can think of two options:

    1. Use a IF condition and if the value is null, use the first value else use the selected value
    2. Add "Choose a value" as the first entry and if value = null, then return an error

    What's the general strategy to handle value setting in drop down?
  • lucasg-1279826971810992278

    Lucas G

    1 year ago

    If you’re setting it to a variable, you can have the first option be the initial default value of the variable
    👍🏽1