Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automplete always sets label instead of value #84

Closed
siloam opened this issue Nov 7, 2021 · 2 comments
Closed

Automplete always sets label instead of value #84

siloam opened this issue Nov 7, 2021 · 2 comments

Comments

@siloam
Copy link

siloam commented Nov 7, 2021

Development Relevant Information:

  • BalmUI version: 9.37.2
  • Browser: Google Chrome 95.0.4638.69
  • Operating System: Windows 10 64-bit

Description:

Autocomplete always sets label under v-model property instead of value. Defining sourceFormat prop does not help. Expected behaviour is to set value when desired label is chosen. Moreover not matched in-the-middle results are also mapped to v-model and it can leads to unpredictable results. It is not a blocker and can be easily fixed using @selected event, but its just not expected while an array of objects is provided and value is defined excplicite.

Steps To Reproduce:

Just test it.

@elf-mouse
Copy link
Member

elf-mouse commented Nov 9, 2021

Hi @siloam , thank you for your advice :)

Yes, Autocomplete is essentially a Textfield, so its model binding label.

  • If your label and value are the same, you can set the source prop to be a string array ([ 'value1', 'value2' ])
  • If your label and value are different, you can set the source prop to be a object array ([{ label: 'choice1', value: 'value1' }, ...]), then use @selected event for specific operations

@siloam
Copy link
Author

siloam commented Nov 12, 2021

Thanks for advice. I have chosen the second option. Works like a charm :)

@siloam siloam closed this as completed Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants