# CheckBoxList Validator

**URL:** <https://forum.radzen.com/t/checkboxlist-validator/8712>\
**Category:** Angular\
**Created:** [August 17, 2021, 7:00am UTC](https://forum.radzen.com/t/checkboxlist-validator/8712 "2021-08-17T07:00:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![d.kotou](https://forum.radzen.com/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@d.kotou](https://forum.radzen.com/u/d.kotou)\
**Post date:** [August 17, 2021, 7:00am UTC](https://forum.radzen.com/t/checkboxlist-validator/8712/1 "2021-08-17T07:00:45Z")

</div>

Hello,

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?](http://forum.radzen.com/t/dynamic-one-to-many-checkbox-list/1092) - the RequiredValidator does not work with those settings.

Is it possible to use the RequiredValidator with my configuration?

Thanks!

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [August 17, 2021, 4:29pm UTC](https://forum.radzen.com/t/checkboxlist-validator/8712/2 "2021-08-17T16:29:37Z")

</div>

Hi @d.kotou,

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.

---

<div class="post-metadata">

**Author:** ![d.kotou](https://forum.radzen.com/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@d.kotou](https://forum.radzen.com/u/d.kotou)\
**Post date:** [August 18, 2021, 6:45am UTC](https://forum.radzen.com/t/checkboxlist-validator/8712/3 "2021-08-18T06:45:17Z")

</div>

Thank you! 🙂 That works perfectly!

---

<div class="post-metadata">

**Author:** ![d.kotou](https://forum.radzen.com/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@d.kotou](https://forum.radzen.com/u/d.kotou)\
**Post date:** [August 18, 2021, 7:30am UTC](https://forum.radzen.com/t/checkboxlist-validator/8712/4 "2021-08-18T07:30:06Z")

</div>

Hi @korchev,

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'.

Do you have an idea why this error pops up?

Thank you!

---

<div class="post-metadata">

**Author:** ![d.kotou](https://forum.radzen.com/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@d.kotou](https://forum.radzen.com/u/d.kotou)\
**Post date:** [August 18, 2021, 7:56am UTC](https://forum.radzen.com/t/checkboxlist-validator/8712/5 "2021-08-18T07:56:05Z")

</div>

Hi @korchev,  
i just solved the error problem.  
Thanks!

---

<div class="post-metadata">

**Author:** ![d.kotou](https://forum.radzen.com/letter_avatar_proxy/v4/letter/d/c6cbf5/32.png) [@d.kotou](https://forum.radzen.com/u/d.kotou)\
**Post date:** [September 2, 2021, 7:23am UTC](https://forum.radzen.com/t/checkboxlist-validator/8712/6 "2021-09-02T07:23:49Z")

</div>

Hi @korchev,

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).

Do you have any idea how to fix this?

Thank You!
