You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: field1 is uncontrolled, field2 is controlled.
Uncheck both isDisabled and isRequired boxes. Submit the form. In the console, you should see the form values object. field1 and field2 are empty strings.
Check only isDisabled box. Submit the form. In the console, you should see the form values object. field1 and field2 are undefined.
Check only isRequired box. Submit the form (leave the text fields empty). You should see "field1 field2" string under the submit button indicating both fields are invalid.
Check both isDisabled and isRequired boxes. Submit the form (leave the text fields empty). You should see "field2" string under the submit button indicating only field2 is invalid.
Expected behaviour
So, the disabled prop of the register method 1) disables the input, 2) leads the input value to be undefined, 3) omits built-in validation rules. But the disabled prop of the Controller component does only 1) and 2), but not 3). It does not skip validation.
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Version Number
7.48.2
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/competent-butterfly-yfgzsf?file=%2Fsrc%2FApp.js%3A1%2C17
Steps to reproduce
Note:
field1
is uncontrolled,field2
is controlled.isDisabled
andisRequired
boxes. Submit the form. In the console, you should see the form values object.field1
andfield2
are empty strings.isDisabled
box. Submit the form. In the console, you should see the form values object.field1
andfield2
areundefined
.isRequired
box. Submit the form (leave the text fields empty). You should see "field1 field2" string under the submit button indicating both fields are invalid.isDisabled
andisRequired
boxes. Submit the form (leave the text fields empty). You should see "field2" string under the submit button indicating onlyfield2
is invalid.Expected behaviour
So, the
disabled
prop of theregister
method 1) disables the input, 2) leads the input value to beundefined
, 3) omits built-in validation rules. But thedisabled
prop of theController
component does only 1) and 2), but not 3). It does not skip validation.What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: