react-final-form-html5-validation icon indicating copy to clipboard operation
react-final-form-html5-validation copied to clipboard

Field continues to be required even after changing required prop to false

Open TylerRick opened this issue 6 years ago • 2 comments

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

If required prop is initially true, then the validate function continues to require the field to be filled in, even if you later change the required prop to false.

What is the expected behavior?

As soon as required prop changes, validation checks should reflect that that. So if you change it to false, the field should no longer be required.

Sandbox Link

https://codesandbox.io/s/react-final-form-html5-validation-example-n2q8d

Other information

Likely related to #13

TylerRick avatar Sep 19 '19 15:09 TylerRick

Note that the problem goes away if you change it to use the Field from 'react-final-form' instead.

TylerRick avatar Sep 19 '19 16:09 TylerRick

As a workaround, you can set key to the same thing as you set required prop to. But we shouldn't have to resort to this, should we??

TylerRick avatar Sep 19 '19 16:09 TylerRick