svelte-forms-lib icon indicating copy to clipboard operation
svelte-forms-lib copied to clipboard

Have form.reset()

Open shellking4 opened this issue 2 years ago • 2 comments

I don't know if it already exists and I'm not aware of it but I think we should have a reset method on form and use that to reset form after validations have succeeded and form submitted correctly.

shellking4 avatar May 30 '23 23:05 shellking4

@shellking4 createForm exposes a Svelte writable store named form. You can manually update the state by doing .set(INITIAL_STATE).

E.g.,

const initFormState = {
  email: '',
  password: '',
}

form.set(initFormState)  // reset fields

taronaeo avatar Jul 07 '23 14:07 taronaeo

I think we have something like handleReset function

jobayer977 avatar Dec 08 '23 14:12 jobayer977