Hey everybody,
thanks for the nice component. I'm searching for a solution to use this combo box as simple dropdown in some cases but I couldn't find a way to just select items from the given items
attribute.
When I use <vaadin-combo-box allow-custom-value="false">
I can input any value into the input field. Is this really the intended behaviour?
This is how boolean attributes work: if you set the attribute, it means true
, if you remove it - it means false
. You cannot pass false
in a way you do it, so just remove attribute and you will be fine. You can use data bindings to specify if custom value should be allowed, though.
If you don’t want to allow the user to type into the field, and only open the dropdown when the field is clicked, you can use vaadin-combo-box-light, and use a read-only input element instead. Here’s a quick example: http://jsbin.com/loqobonake/edit?html,output
From there, you can style the input to look like something else if needed.
@web-padawan, @jouni: Thanks for the input. This works! 👍
Most helpful comment
This is how boolean attributes work: if you set the attribute, it means
true
, if you remove it - it meansfalse
. You cannot passfalse
in a way you do it, so just remove attribute and you will be fine. You can use data bindings to specify if custom value should be allowed, though.