CMS Development

tricialeach
Member

Default Values for RepeatedFieldGroup

Hello,

 

How can we pass in default values to RepeatedFieldGroups? I tried this example from the docs in CMS React, and the default values are not reflected in the page editor.

 

Would it be possible to get an answer to this, and the docs updated?

 

Thank you!

 

https://developers.hubspot.com/docs/guides/cms/react/modules#repeated-field-groups

0 Upvotes
3 Replies 3
raohenry
Member

Default Values for RepeatedFieldGroup

 

Hi @tricialeach ,

 

You're right—setting default values for RepeatedFieldGroup in CMS React doesn't always reflect properly in the page editor.

 

To make it work, try initializing the field values explicitly in the schema’s defaultValue or initialValue, depending on your CMS setup. For example:

 

defaultValue: [ { title: "Default Title", description: "Default Description" } ]

Also, ensure the component handling the RepeatedFieldGroup is set up to recognize and render the initial values.

 

It’s definitely worth updating the docs for clarity—hopefully the team can address that soon!

 

Let me know if you want a code example tailored to your setup.

0 Upvotes
tricialeach
Member

Default Values for RepeatedFieldGroup

Thanks for very for your response! I actually worked out that passing a default value almost got me there. The default values now show up in the page editor, but they don't actually show up on the page, unless I manually go into the fields to update them. Do you see this behavior too?

0 Upvotes
tricialeach
Member

Default Values for RepeatedFieldGroup

For some additional context, I am only seeing this bug when I used a RepeatedFieldGroup that is nested inside a Field Group. This is the result:

 

Screenshot 2025-06-11 at 10.23.31 AM.png

Screenshot 2025-06-11 at 10.23.24 AM.png

Screenshot 2025-06-11 at 10.23.18 AM.png

   

0 Upvotes