Skip to content

Virtual Fields not updating #6073

Answered by jmikrut
amifsud02 asked this question in Q&A
Discussion options

You must be logged in to vote

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 the title 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 the title value, and then use the useField hook to set the value of your fullTitle field as the

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by amifsud02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #6072 on April 27, 2024 15:48.