From bed35981115e97cb78fe2c50ce78dbf821a7b3cc Mon Sep 17 00:00:00 2001 From: Edmund Hung Date: Thu, 28 Mar 2024 19:05:39 +0100 Subject: [PATCH] add basic test --- playground/app/routes/subscription.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/playground/app/routes/subscription.tsx b/playground/app/routes/subscription.tsx index 61ddde22..c1a84422 100644 --- a/playground/app/routes/subscription.tsx +++ b/playground/app/routes/subscription.tsx @@ -61,6 +61,12 @@ export default function Example() { onValidate: !noClientValidate ? ({ formData }) => parseWithZod(formData, { schema }) : undefined, + onSubmit(event) { + // We should be able to access the latest form / field metadata anytime + if (!form.dirty || !(fields.name.dirty || fields.message.dirty)) { + event.preventDefault(); + } + }, }); const name = fields.name.name; const message = fields.message.name;