0
votes

I have Formik form where initialValues are not empty for all fields. I have the following condition on my submit button:

disabled={!(dirty && isValid)}

Yup validation schema:

const signInSchema = Yup.object().shape({
    title: Yup.string()
      .required(),
    description: Yup.string()
      .required(),
    spec: Yup.string()
      .required(),
    link: Yup.string()
      .url()
      .required(t),
  });

Why is the submit button disabled until I change value in some field? How can I make submit button enabled for this case if all initialValues are correct and I have not made any changes to the form fields?

1

1 Answers

0
votes

I am pretty sure that's what the dirty prop is meant to do. Check for changes on the initial state of the form.

Try removing it.

disabled={!isValid}