unobtrusive-angular-validation icon indicating copy to clipboard operation
unobtrusive-angular-validation copied to clipboard

Validation Attributes added though a directive are ignored

Open swadsworth opened this issue 8 years ago • 0 comments

I have a form that is dynamically built. Each input has a directive that adds attributes for validation based on data from the server. However when the attributes are added the attributes are ignored. example `

<input id="question-{{question.questionId}}" name="{{question.questionId}}" data-val-required="@Misc.GetResourceByKey("RequiredField")" ng-model="question.value" class="form-control text-box-control" />
` and in my directive I add an attribute if its required `var input = element.find('input'); if (question.required) { input.attr('data-val', question.required); } `

if the data-val attribute is added this way the form says its valid even though required inputs have not been filled in

swadsworth avatar May 18 '16 19:05 swadsworth