nelsonomuto / angular-ui-form-validation

Directives for angularjs field validation
http://nelsonomuto.github.io/angular-ui-form-validation
MIT License
180 stars 51 forks source link

validation always validate even if ng-required =false and ng-disabled =true #61

Open Stefanus87 opened 9 years ago

Stefanus87 commented 9 years ago

Please help I have a form with allot of input fields. The fields is disabled with certain senarios based on certain fields on the form. The validation validate the fields even if it is not reguired and disabled. Is this a bug or a coding issue? Thanks

nelsonomuto commented 9 years ago

Good point, the validations are independent of angular ng directives. So ng-required and ng-disabled will not have an effect on them. This is not a bug.

For good measure I will add a new feature that will give you the ability to toggle validations on and off (validation-active="true/false" depending on whether you wish for the validations to trigger or not.)

In the meantime you may workaround this by not adding an identical input element without the validation directives and add your ng-required and ng-disabled to it, then apply logic to hide the original input element and display the new one whenever you wish to disable validations.