I am trying to use the tags input type but have the enum that drives the list of valid values for the tags. My idea is to have another field that is a reference input type that references another content model that has the list of values. When that value is selected I would then want to update the enum for the tags input to use the values from it as the dropdown values. I can see in this documentation Using model validation hooks that’s possible to use validation hooks to set the value of another field but how can i set the enumeration of that field?
This is how i am hoping to do it by setting a change hook on the first field but it doesn’t seem to work
const listValue = options.get('listValues');
if (listValue === 'one') {
model.data.set('tags', { enum: ['seo', 'email', 'social'] });
} else if (listValue === 'two') {
model.data.set('tags', { enum: ['crm', 'pipeline', 'lead'] });
} else if (listValue === 'three') {
model.data.set('tags', { enum: ['foo', 'bar', 'baz'] });
}else {
model.data.set('tags', { enum: [] }); // or default/fallback tags
}