I am trying to create a dynamic form using Elm such that depending upon the dropdown selection, a form or message would appear. I have a working version of it in Ellie: https://ellie-app.com/bC4QH7n8dGPa1
I was able to create an input field when we select “Available” in the dropdown but I want another input field to be displayed when I click on “Unavailable”. I tried doing it the same way as I did for Available but I wasn’t able to do it for another option “unavailable”. How can I display a new input field when someone clicks “unavailable”?
This is perfect. If I may ask what would be a better naming for:
buildOption ( k, v ) =
option [ value k, selected (k == model.isAvailable) ] [ text v ]
viewOptions =
List.map buildOption options
I have read the code somewhere for build Option but I really didn’t understand what it is doing:
buildOption ( k, v ) =
option [ value k, selected (k == model.isAvailable) ] [ text v ]