Is it correct, that field validation, does not work in sets? I have a Repeater-field which itself contains a set of other fields. This is all working fine, but I cannot seem to validate the fields within the set.
{
"field": {
"type": "set",
"options": {
"fields": [
{
"name": "text",
"label": "Text",
"maxlength": "200",
"required": true,
"type": "text"
},
...
]
}
}
}
Neither shows me an error when the field is empty, nor when I enter more then 200 characters.
Is there no possibility to validate fields listed in a Set?
I’m not sure right now, if validation works inside sets and repeaters - but if or if not, you have to adjust your field options a little bit so the nested fields receive their options properly:
{
"field": {
"type": "set",
"options": {
"fields": [
{
"name": "text",
"label": "Text",
"type": "text",
"options": { // <-- nested field options
"maxlength": "200",
"required": true,
}
},
...
]
}
}
}
As always spot on. Thanks!
Field validation does not work in sets of fields in repeater?
{
“fields”: [
{
“type”: “set”,
“label”: “Category”,
“options”: {
“display”: “name”,
“fields”: [
{
“name”: “parentName”,
“type”: “text”,
“label”: “Parent name”
},
{
“name”: “categoryName”,
“type”: “text”,
“label”: “Category”,
“options”: {
“required”: true
}
},
{
“name”: “categoryNote”,
“type”: “textarea”,
“label”: “Note”
},
{
“name”: “categoryOrder”,
“type”: “text”,
“label”: “Order”,
“options”: {
“type”: “number”,
“rows”: 2
}
},
{
“name”: “categoryImg”,
“type”: “image”,
“label”: “Image”
}
]
}
}
]
}