T
TanStack•2y ago
grumpy-cyan

validateFormData in Solid Start Action

I'm currently testing out TanStack Form in SolidJS, and was trying to see how well I could get it working with the Actions built into Solid Start. Here's a code snippet of what I'm working with
var formFactory = createFormFactory(() => ({
defaultValues: {
username: "",
password: "",
},
validatorAdapter: zodValidator,
}));

const login = action(async (formData: FormData) => {
"use server";
...
});
var formFactory = createFormFactory(() => ({
defaultValues: {
username: "",
password: "",
},
validatorAdapter: zodValidator,
}));

const login = action(async (formData: FormData) => {
"use server";
...
});
For the react version, I see you can add onServerValidate to the form factory, which lets you call formFactory.validateFormData(formData); in the action. I don't see an equivalent for SolidJS though, is that somewhere else or not implemented yet?
2 Replies
magic-beige
magic-beige•2y ago
It's not implemented but should be fairly trivial to do! Wanna help us implement and document it? 🙂
grumpy-cyan
grumpy-cyanOP•2y ago
Sorry, just noticed this reply. Been rather busy these last few weeks but I'll open up a PR when I got some free time! 🙂

Did you find this page helpful?