svelte-select icon indicating copy to clipboard operation
svelte-select copied to clipboard

Unable to get the value of svelte-select

Open exqmjmz opened this issue 1 year ago • 2 comments

I used svelte-select as select plugin image image This is a simplified example The input component input can get the value The value cannot be obtained after the select component is selected

<script>
  import Select from "[email protected]";
	import { useForm } from "[email protected]";
	const form = useForm();
  let collection = [
    { value: 1, label: "one" },
    { value: 2, label: "two" },
    { value: 3, label: "three" }
  ];
</script>

<form use:form>
<input name="test" >
<Select name="select" items={collection} />

</form>

<pre>
{JSON.stringify($form, null, " ")}
</pre>

svelte-app.zip

exqmjmz avatar May 11 '23 08:05 exqmjmz

@ljm000 Do you mean, if you use document.querySelector to get the svelte select component, you cannot retrieve the value from it?

EddTally avatar Jun 23 '23 10:06 EddTally

You can add a input hidden with value={justValue} and set the select with bind:justvalue

avillegas avatar Aug 03 '23 21:08 avillegas