angular-dynamic-forms icon indicating copy to clipboard operation
angular-dynamic-forms copied to clipboard

how to add required in checklist

Open thavaamm opened this issue 9 years ago • 3 comments

if i set below object, it always asks me to select both checkbox while validation. My requirement validation should be passed if at least one check box selected.

{ "type": "checklist", "model": "template_field_id_"+field.id, "label": field.label+require, "options": { "first": { "label": "first option" }, "second": { "label" : "second option", } }, "required":true

}

please help me to handle it.

thavaamm avatar Apr 24 '16 19:04 thavaamm

Since the required key adds an ng-required attribute to the form elements, with the template's value as the attribute's value, simply replace true with "!template_field_id_"+field.id - this makes both checkboxes required unless the model has a value.

danhunsaker avatar Apr 25 '16 00:04 danhunsaker

i did as you suggested, but still not working. For e.g there are 10 checkboxes, if i selected any one of them, it should make all the checkboxes's ng-required value to be changed as false.

thavaamm avatar Apr 25 '16 17:04 thavaamm

It certainly should, yes. Very strange.

Unfortunately, I don't have much time to work with at the moment, so I can't investigate properly. Not sure when, exactly, I'll have the time, either, which is frustrating for both of us, I'm sure. If you're on a time crunch, you may want to look into one of the alternative projects listed in the README...

Sorry I can't do more right now...

danhunsaker avatar Apr 25 '16 18:04 danhunsaker