Autocomplete showing value instead of label when selected
Autocomplete showing value instead of label when selected
Hi, i'm trying to use an autocomplete field type where options are a label->value pair.
When i select a result from the option list, i expect the input shows me the label and "behind" it has the ID saved to be sent.
This does not happens.
Try it here: https://live.datatables.net/holeqaca/3/edit
Create a new item, select an Office and it will show the ID instead of the office name.
It's not cool to show the user the id...
Any way to solve this?
Thank you
Replies
Hi,
You need to use
tags
for this - see this example.The
autocomplete
field type is a plain text input - i.e. what is submitted is what is shown. Tags is the solution - it has the ability to show a label that is distinct from the value.Allan
Thank you @allan. I tried and it works as expected.
I think it should be explained better in docs.
Good to hear that helps!
I'll add a paragraph to the
autocomplete
description. Thanks for pointing out that is missing.Edit: I've just committed the follow, which will be up on the site with the next deploy:
Allan