Open ChocoLZS opened 10 months ago
Funny, I came here from an almost identical problem on the same day you posted this. I believe the same issue is happening with the following steps:
https://github.com/radix-ui/primitives/assets/92333589/37f2bfae-9c6f-469c-8266-8d6366225224
Give a try to fix this one and I think I have it here https://github.com/radix-ui/primitives/pull/2560 Review and guidance is appreciated, thanks!
I was able to get the form to validate a custom matcher for copy and paste:
const handleMatcher: SyncCustomMatcher = (value) => value === 'equal';
<FormMessage match={handleMatcher}> Your Custom Matcher Error Message </FormMessage>
I'm not sure what your code looks like, but if you use the SyncCustomMatcher (or AsyncCustomMatcher) as the type for the function being passed to match, you should be able to see the error on copy and paste. Perhaps we need a more flexible solution than that (maybe a more flexible type definition), but that worked for me!
Bug report
Current Behavior
https://github.com/radix-ui/primitives/assets/61224208/b4cceb98-efb1-4eb1-a55f-9d3d86cca831
Expected behavior
Reproducible example
CodeSandbox Template
Suggested solution
Additional context
Your environment
Radix-ui form official Codesandbox