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
I'm working with forms that require showing "alerts/warnings" on some fields after validating them.
For example, after entering a text in a field, the validation of that field should be triggered and if the value of the field matches a previously fetched array of values, the field should show a warning message of some sort (eg. "the value already exists").
The thing is that the message shouldn't be treated as a validation error, meaning that the form should still be submittable (if there are no other fields with an actual error).
If I have understood the docs correctly, there is no way for achieving this currently. Is that correct?
If that is not correct, how can I handle a case like the one I just described?
The text was updated successfully, but these errors were encountered:
Hi @alexandernst. Yes, you are correct - there's no way of implementing such warnings using the error handling. I think the easiest would be to either create fully customized fields or just wrappers on the existing ones. In both cases, such a component would access value (and all other required props) and render the warning on its own or somehow, using field props (e.g. errorMessage with additional styling).
A completely different approach would be to create WarningField. It would work like any other field except it won't ever call onChange. Each time its value change (e.g. using useMemo), you can call some external logic to fetch and show warnings.
I'm working with forms that require showing "alerts/warnings" on some fields after validating them.
For example, after entering a text in a field, the validation of that field should be triggered and if the value of the field matches a previously fetched array of values, the field should show a warning message of some sort (eg. "the value already exists").
The thing is that the message shouldn't be treated as a validation error, meaning that the form should still be submittable (if there are no other fields with an actual error).
If I have understood the docs correctly, there is no way for achieving this currently. Is that correct?
If that is not correct, how can I handle a case like the one I just described?
The text was updated successfully, but these errors were encountered: