1

While using the svelte-forms in sveltekit I am getting the following runtime error even calling the function inside the onMount

funtion called outside component initialisation

1 Answer 1

1

This can be solved by providing validateOnChange option in form function.

<script>
  import { onMount, afterUpdate } from 'svelte';
  import { form } from 'svelte-forms';

  let myForm;

  onMount(() => {
    myForm = form(() => ({}), {
      validateOnChange: false
    });
  });

  afterUpdate(() => {
    myForm.validate();
  });
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.