This is a simple package for client side form validation for svelte and sveltekit without schemas. It has simple syntax for setting up validators for your fields
import { createForm } from "svelte-simple-forms";
const form = createForm({
email: {
email: true,
required: true
},
password: {
required: true,
min: 6
},
repassword: {
required: true,
equalTo: 'password'
}
});
$: {
form.validate();
}
<form class="">
<label>
Email
<input type="email" bind:value={form.email} />
{#each form.errors.email as error}
<p>{error}</p>
{/each}
</label>
<label>
Passowrd
<input type="email" bind:value={form.password} />
{#each form.errors.password as error}
<p>{error}</p>
{/each}
</label>
<label>
RePassoword
<input type="email" bind:value={form.repassword} />
{#each form.errors.repassword as error}
<p>{error}</p>
{/each}
</label>
</form>
You can contribute and report issues at Github.