I have 4 checkboxes in my form and want user to select at least one of the checkbox when form is submitted.
I am using ExpressiveAnnotations.Attributes; reference as we use this in other part of project but it doesn't seems to be working for checkboxes.
I have 4 checkboxes lets say they are A, B, C, D and I have declared checkbox D as:
[Display(Name = "D Name")]
[AssertThat("(A == false) && (B == false) && (C == false) && (D== false)", ErrorMessage = "Required")]
public bool D { get; set; }
If I change 'AssertThat' to 'RequiredIf' - then it errors that A,B,C,D need to be Nullable
When I submit the form, all the other validations on the form works except this one. Once submitted, I can see the value of A,B,C,D are false.
I have looked into custom validation but can't seem to find what I am looking for.
Has anyone else has encountered this issue? Any help will be appreciated
Thanks,
tried looking into custom validation but no luck.