-
Hi, I builded form the same way as shadcn-svelte docs reccomend. <Form.Field {config} name="image">
<Form.Item>
<Form.Label>Image</Form.Label>
<Input type="file" on:change={handleUpload} />
<Form.Validation />
</Form.Item>
</Form.Field> in the handleUpload i handle uploading of image and there i want somehow to write a value to image field |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I found solution for that you expose setValue function from Form.Field and pass it to you handler invoked by onChange <Form.Field {config} name="image" let:setValue>
<Form.Item>
<Form.Label>Zdjecie</Form.Label>
<Input type="file" on:change={(e) => handleUpload(e, setValue)} />
<Form.Validation />
</Form.Item>
</Form.Field> |
Beta Was this translation helpful? Give feedback.
Found another solution
You need to add Form.Input with hidden class, so that it will properly set value