Closed Haaxor1689 closed 1 year ago
Check your validator function return. If you change the return to {errors: { field: "Error" }}
it works as expected
validate={(v) =>
v.field?.a?.length !== v.field?.b?.length
? {errors: { field: "Error" }}
: undefined
}
Are you submitting a bug report or a feature request?
Bug report
What is the current behavior?
If the
value
of key I try to set error on is an object, the error comes out as an object as well. So let's say I return from validate{ field: 'Error' }
. In theerrors
it will be{"field":{"0":"E","1":"r","2":"r","3":"o","4":"r"}}
instead.What is the expected behavior?
If I set the error of object type attribute, I'd like it to remain a string.
Sandbox Link
https://codesandbox.io/s/elastic-tom-rtk8s8?file=/src/App.js
What's your environment?
See code sandbox
Other information
829 describes similar issue but with IE and slightly different use case