timekit-io / booking-js

:date: Make a beautiful embeddable booking widget in minutes
https://developers.timekit.io/docs/booking-widget-v2
MIT License
2.42k stars 188 forks source link

No way of prefilling a select field. #261

Open hugo-lobo opened 2 years ago

hugo-lobo commented 2 years ago

During testing of one of our flows it was noticed that the select field didn't have the correct option prefilled. After investigating I found that passing a prefilled value to a dropdown (select) type field will cause all options in the list to have the selected attribute in the HTML due to the mustache logic in your select.html template.

Using objects as the values of an enum array: customer_fields: { select_field_example: { enum: [ {value: 'Option 1', prefilled: true}, {value: 'Option 2'} ] } } } works to select only one of the options but then it will render as [object Object] when using the dropdown as the binding in the mustache template refers to it by the {.} syntax, referencing the whole object.