svecosystem / formsnap

Functional, accessible, and powerful form components for Svelte. 🫰
https://formsnap.dev
MIT License
593 stars 28 forks source link

Form.Input and Form.Textarea value prop is not reactive #91

Closed gprieto closed 1 year ago

gprieto commented 1 year ago

I have a form where I want to reactively assign the value for a field, like so:

<Form.Field {config} name="content">
        <Form.Item  >
            <Form.Input value={$content} />
            <Form.Validation />
        </Form.Item>
</Form.Field>

It seems that in this scenario the value of the field "content" is only updated on mount and not on the following changes of $content.

I tried to bind the prop, but then what happens is that the initial state of the field value which is an empty string, overwrites my store value $content.

huntabyte commented 1 year ago

The <Form.Input /> was not designed to be used in this manner. If you're using it, it will automatically take on the value of that specific field in the form via the Superform store.