I have a custom Edit View component that uses a custom button in place of the publish button. It still "publishes" but with some extra onClick logic so I can't just use the normal <PublishButton/>. The issue I'm having is that I lose form validation when doing this, so fields aren't being highlighted when they should be (ie., required field missing when publishing). I found the validateForm() method that should be retrievable with the useForm() hook but useForm() and useDocumentForm() both return undefined! Other react hooks like useConfig() etc work fine and it doesn't appear to be an case of having duplicate Payload/react/react-dom versions. Any help is appreciated!
#useForm() returning undefined
2 messages · Page 1 of 1 (latest)
Help is on the way! To mark it as solved, use the /solve command. In the meantime, here are some existing threads that may help you:
Documentation:
- React Hooks - useForm
- React Hooks - useDocumentForm
- Fields Overview - Field Options - Validation - Async Field Validations
- Fields Overview - Field Options - Validation - Validation Context