I have a block that is pulling in a stats collection, but I'd like to set the min/max of that field. Am I thinking about this in the wrong way?
const Statistics: Block = {
slug: 'statistic',
labels: {
singular: 'Statistic',
plural: 'Statistics',
},
fields: [
{
name: 'stat',
label: 'Statistic(s)',
type: 'relationship',
hasMany: true,
relationTo: 'stat',
},
],
};How do I limit the number of stats a person is allowed to use?
Hi
@540666559170084875this is not currently supported out of the box but would make a
greatnew feature
well, i guess this is one way to do it 🙂
const StatisticsBlock: Block = {
slug: 'statisticBlock',
labels: {
singular: 'Statistic Block',
plural: 'Statistic Blocks',
},
fields: [
{
name: 'statArray',
label: 'Statistic(s)',
type: 'array',
minRows: 1,
maxRows: 3,
fields: [
{
name: 'stat',
type: 'relationship',
relationTo: 'statistic',
},
],
},
],
};Good thinking! That’s a nice little workaround for now.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.