Hi, I’ve got a ui/custom field in a collection. From that component I want to populate other fields – how can I do that?
Thanks! 🙂
Ah that’s probably what I’m looking for rougly – the docs are sadly
verybarebones
My current gameplan is to use
const { dispatchFields } = useForm()
as I need to change a bunch of Fields once a user presses a button
dispatchFields({
type: 'UPDATE',
path: 'name',
value: selectedDevice.Name,
requiresRender: true,
})
When I try to do this, I get this error though
Uncaught TypeError: dispatchFields is not a function
Also, when I log out useForm() i get an empty object
Duplicate Payload Versions in my monorepo was the culprit …
Check out the
useFormFields
React hook. Details here:
https://payloadcms.com/docs/admin/hooks#useformfieldsStar
Discord
online
Get dedicated engineering support directly from the Payload team.