Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form cannot be resubmitted after an error thrown in onSubmit #418

Open
malash opened this issue Sep 17, 2021 · 0 comments
Open

Form cannot be resubmitted after an error thrown in onSubmit #418

malash opened this issue Sep 17, 2021 · 0 comments

Comments

@malash
Copy link

malash commented Sep 17, 2021

The Form component support throwing error in its onSubmit callback and renders the error message. But I my application, the FormAction is not reset to enabled even if I modify the input.

Full example: https://codesandbox.io/s/trusting-brown-42suu

Root cause:

return <BaseFormActions {...props} disabled={!valid} processing={submitting} />;

A possible solution:

export default function FormActions(props: FormActionsProps) {
  const form = useForm();
  // this line changed
  const { submitting, valid, dirtySinceLastSubmit } = form.getState();

  return (
    <BaseFormActions
      {...props}
      // this line changed
      disabled={!dirtySinceLastSubmit && !valid}
      processing={submitting}
    />
  );
}

Ref: final-form/final-form#48 (comment)

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

No branches or pull requests

1 participant