I´m trying to set RequiredValidator on a CheckBoxList in a Form.
CheckBoxList-Value is linked to an PageProperty which represents an array.
But the Validator-warning does not show when I klick form submit button…
When I set the options of the CheckBoxList manually, the RequiredValidator works.
But I want to bind the CheckBoxList-options to an array coming from the database, just like I found here: Dynamic One-to-Many Checkbox List? - the RequiredValidator does not work with those settings.
Is it possible to use the RequiredValidator with my configuration?
Try setting the Visible property of both the CheckBoxList and the RequiredValidator to ${yourOptionsProperty != null} where yourOptionsProperty is the page property that contains the checkbox options. This should delay the initialization of the validator until the options are available.
i have one more question. When I open the add or edit-page with the CheckBoxList, i get following error in the console:
add-mittelherkunft.component.html:3
ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'component: undefined'. Current value: 'component: [object Object]'.
and
checkboxlist.d.ts.CheckBoxListComponent.html:6 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ng-valid: true'. Current value: 'ng-valid: false'.
I still get this error:
Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'component: undefined'. Current value: 'component: [object Object]'
when I open the Edit or Add Page.
I never had this problem, so i assume it has to do with the checboxlist(its the first time im using it).