angular-dynamic-forms
angular-dynamic-forms copied to clipboard
how to add required in checklist
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.
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.
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.
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...