How can we lock (disable) the submit button while action
is being executed?
#790
-
I want to pass https://www.rvf-js.io/reference/form-api#form-state The competing component RVF can do this by monitoring |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Conform is designed to handle validation only and will prevent form submission if validation fails. However, the actual submission is left to the Remix To disable the submit button while validation passes and the action is running, you can use Remix’s useNavigation or useFetcher to monitor the submission state: import { Form, useNavigation } from "@remix-run/react";
function MyForm() {
const navigation = useNavigation();
const isSubmitting = navigation.state === "submitting";
return (
<Form method="post">
{/* form fields */}
<button type="submit" disabled={isSubmitting}>
Submit
</button>
</Form>
);
} |
Beta Was this translation helpful? Give feedback.
Conform is designed to handle validation only and will prevent form submission if validation fails. However, the actual submission is left to the Remix
<Form>
component, which differs from RVF’s approach.To disable the submit button while validation passes and the action is running, you can use Remix’s useNavigation or useFetcher to monitor the submission state: