Unique default content per each default object instantiated from a repeatable group module.

Hi,

I have a module with a repetable group. I set the default object count to 9 in the repeater options. I would like to give each of the 9 objects their own initial default content. Currently, each object pulls in the default content from the fields default content within the group. See attached photos. How can I give the 9 default instances their own default content?


Current values (pulled in from default field content)

Values I would like to be default for each of the 9 default objects

Best,

John

Hi @jshockey ,

While it is not possible to give items in a repeater field their own default content, you can do this on the template level. Once you add the module to a template you are able to make edits to the module, and the content you add/change in the module will stick to the template, which will transfer over to any pages created with that template.

@Jsum Thanks for the response!

And how do you do this? can i ask for an example pice of code?

You can do this through the CLI, if you edit the module/fields.json file
locate the group you are trying to target

{"tab" : "CONTENT",
 "expanded" : false,
 "type" : "group",
 "default" : {"feature_title": "Resource Database": "stat_number": "9.3"}
}

and convert the “default” object to an array with []
and add objects to the array like so

{"tab" : "CONTENT",
 "expanded" : false,
 "type" : "group",
 "default" : [
 {"feature_title": "Resource Database": "stat_number": "9.3"},
 {"feature_title": "Resource Allocation": "stat_number": "1.2"},
 {"feature_title": "Workload Capacity": "stat_number": "8.0"},
 {"feature_title": "Time Tracking": "stat_number": "6.8"}
 ]
}

Be sure to refresh the page editor before adding a new instance of this module, and then you should see 4 repeater objects if you add a new instance of the module to the page.

Hi @tjoyce, i’m having the same issue that I would like to give unique values to repeated items. For me I would like to change a colour for each of the items. Is that also possible with JSON? And what of the code you gave do I need to adjust?