Aurelia check - check multiple flags or radio stations

I am trying to verify that at least 1 checkbox was selected using the Aurelia validator. I assumed that using the minItems () method would suffice, but it looks like I can only make this work a hack, using a hidden item that points to my array. Does anyone know of a simpler approach to handling this?

+3


source to share


1 answer


When working with groups of radio stations or checkboxes, it is easiest to check the validity in the group rather than on each individual input element. This approach requires creating a custom element for "checkbox-group" and / or "radio-group". Here is an example of a group of check boxes with validation:

a checkbox that is validation compatible



<label id="color1">
  Colors 1:
  <checkbox-select items-source.bind="colors"
                   value.bind="colors1 & validate"
                   aria-labelledby="color1">
  </checkbox-select>
</label>

      

radio group component check compatible

+5


source







All Articles