You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any examples would be greatly appreciated. I have already seen a few utilizing just super forms but I am failing miserably when it comes to implementing using shadcn-svelte. I specifically can't figure out how to update which schema to use for each step using client side validation. I was trying this at first but no luck:
`<script lang="ts">
import * as Form from "$lib/components/ui/form/index.js";
import { Input } from "$lib/components/ui/input/index.js";
import { zod } from 'sveltekit-superforms/adapters';
import {
type SuperValidated,
type Infer,
superForm,
} from "sveltekit-superforms";
import { schemaStep_1, schemaStep_2, schemaLastStep, type FormSchema } from "./schema";
import SuperDebug from "sveltekit-superforms";
let { data, stepper }: { data: { form: SuperValidated<Infer<FormSchema>> }; stepper: any} =
$props();
const schemaSteps = [zod(schemaStep_1), zod(schemaStep_2), zod(schemaLastStep)]
// Initialize the form with the first schema in the schemaSteps array
// this will be placed in the multi-step form component
const { form: formData, enhance, options } = superForm(data.form, {
validators: schemaSteps[0]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Any examples would be greatly appreciated. I have already seen a few utilizing just super forms but I am failing miserably when it comes to implementing using shadcn-svelte. I specifically can't figure out how to update which schema to use for each step using client side validation. I was trying this at first but no luck:
`<script lang="ts">
import * as Form from "$lib/components/ui/form/index.js";
import { Input } from "$lib/components/ui/input/index.js";
import { zod } from 'sveltekit-superforms/adapters';
import {
type SuperValidated,
type Infer,
superForm,
} from "sveltekit-superforms";
import { schemaStep_1, schemaStep_2, schemaLastStep, type FormSchema } from "./schema";
});
Beta Was this translation helpful? Give feedback.
All reactions