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

valueFieldName not working #202

Open
stinkokenzo opened this issue Mar 14, 2023 · 1 comment
Open

valueFieldName not working #202

stinkokenzo opened this issue Mar 14, 2023 · 1 comment

Comments

@stinkokenzo
Copy link

const countries = [
	{ _id: 1, name: "America" },
	{ _id: 2, name: "Canada" },
	{ _id: 3, name: "China" },
	{ _id: 4, name: "France" },
	{ _id: 5, name: "Germany" },
	{ _id: 6, name: "India" },
	{ _id: 7, name: "Italy" },
	{ _id: 8, name: "Japan" },
	{ _id: 9, name: "Mexico" },
	{ _id: 10, name: "Russia" },
	{ _id: 11, name: "Spain" },
	{ _id: 12, name: "United Kingdom" },
	{ _id: 13, name: "United States" },
]

let country;

<AutoComplete
	name="country"
	placeholder="Select a Country"
	items={countries}
	bind:selectedItem={country}
	labelFunction={(item) => item.name}
	valueFieldName="_id"
/>

The value submitted by the form is the name of the Country and not the _id . Also tried with valueFunction but same issue.

@gponty
Copy link

gponty commented Jan 26, 2024

Same problem here

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