Losing field data with validation
We are currently encountering a situation where when we enable validation on either a multiple_select or multiple_checkbox type we will lose data if we enter more than one option at a time.
If we remove validation from these fields they appear to behave normally. Any tips you can provide, were only interested at present in ensuring the fields are required using multiple choices
{
"field_name": "langcheck",
"label": "Language Checkbox",
"preset": "multiple_checkbox",
"required": true ,
"validators": "scheming_required",
"choices": [
{"value": "en-CA [default]", "label": "English (Canadian)"},
{"value": "fr-CA", "label": "French (Canadian)"}
]
},
{
"field_name": "langselect",
"label": "Language Select",
"preset": "multiple_select",
"required": true ,
"validators": "scheming_required",
"choices": [
{"value": "en-CA [default]", "label": "English (Canadian)"},
{"value": "fr-CA", "label": "French (Canadian)"}
]
},
"required": true should be the only thing necessary. The preset for the multiple choice fields use a different validator
Either that validator should be honouring "required", or we should use scheming_required and modify it to handle multiple choice fields. I expect the former will be easier. scheming_multiple_choice source
With only the setting "required': true The fields are marked as required and are not validated, empty fields can still be submitted.
Did you mean to add "scheming_required" to the list in presets.json as this appears to have no effect
"validators": "scheming_multiple_choice scheming_required",
I mean we either need to enforce required in the scheming_multiple_choice validator or add a new validator afterwards that will fail on empty lists when required=True.