Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Validation Attributes added though a directive are ignored #10

Open
swadsworth opened this issue May 18, 2016 · 0 comments
Open

Validation Attributes added though a directive are ignored #10

swadsworth opened this issue May 18, 2016 · 0 comments

Comments

@swadsworth
Copy link

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
`


* {{question.questionText}}
<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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant