Skip to content

Conversation

azatakmyradov
Copy link

I've started working on this, as @renatomoor is unavailable. Svelte support was copied from #104.
My implementation is using svelte writable store, so it's consistent with the useForm from Inertia form helper.

// Inertia Form Helper
const form = useForm({
    name: '',
    email: '',
    message: ''
});

// Precognition Form Helper
const form = useForm('post', '/contact', {
    name: '',
    email: '',
    message: ''
});

Accessing errors also exactly same as the inertia form helper:

$form.errors.name
$form.valid('name')
$form.invalid('name')

Here's a repo with Inertia/Svelte already setup with simple form setup:
https://github.com/azatakmyradov/precogntion-testform

I tried to make it consistent with other precognition packages, but I haven't worked on NPM packages a lot, so let me know if I missed anything or any improvements I can make.

@taylorotwell taylorotwell marked this pull request as draft July 2, 2025 22:43
@taylorotwell taylorotwell requested a review from timacdonald July 2, 2025 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant