#How to prevent a Input Form Action from deleting/clearing the input after Triggering submission?

1 messages · Page 1 of 1 (latest)

serene meteor
#

I've created the following as part of a svelte component, and I don't think I can do prevent:default .. or can I? How ? Would this prevent the input from being cleared after submit?

// inLineInputForm.svelte
...
// <form method="POST" action="?/updateBio" > 
<form {method} {action} on:keydown={keydown} use:enhance >
    <input {name} bind:value on:blur {required} use:focus class="appearance-none"/>
    <Button type="submit" size="xs" color="light">
                <Icon color="green" icon="lucide:check" />
    </Button>
    <Button type="submit" on:click={cancel} size="xs" color="light">
                <Icon color="red" icon="lucide:x" />
    </Button>
</form>
pine swan
#

I can't imagine it wouldn't be the same pattern

#

something like this

#
  <Button type="submit" on:click|preventDefault={cancel} size="xs" color="light">```