-
I created a virtual field based off Payload's Repo. The page title should be populated automatically. This works find when having the Pages.ts Code
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Can you share your If it matches the exact field in our demo, then the full title will only populate once you save the document. If you want the title to populate from Notice how we have the field component disabled in our example: Just add a component which implements the But, this isn't an issue with Payload (v2 or v3) so I'll convert it into a Q&A discussion so others can find this info as well. Thanks for bringing this up! |
Beta Was this translation helpful? Give feedback.
Can you share your
fullTitle
field?If it matches the exact field in our demo, then the full title will only populate once you save the document.
If you want the title to populate from
fullTitle
as you type, then you will need to have a custom Field component that uses the form state and sets its own value based on when thetitle
field changes.Notice how we have the field component disabled in our example:
https://github.com/payloadcms/website-cms/blob/18748031b64941050fe1d4717963a94d9453e801/src/fields/fullTitle/index.ts#L13
Just add a component which implements the
useFormField
hook to monitor thetitle
value, and then use theuseField
hook to set the value of yourfullTitle
field as the