jonsamwell/angular-auto-validate

How to implement required if

Closed this issue · 3 comments

I'm trying to figure out how to implement a required if type of scenario. For example I have a set of radio buttons and if one is checked then I show some more form elements all of which should be required if that radio button is checked but not required if it is not.
Ideally, the plugin should automatically skip validation on hidden elements, but that's not happening.

I'm thinking I'll need to do this manually but hope not.
Please advise.

Could you provide a plunkr so I can test your scenario? If I'm
understanding you correctly I'm doing this myself using ng-required and it
seems to be working ok?
On 7 Oct 2014 19:00, "dsargent3220" notifications@github.com wrote:

I'm trying to figure out how to implement a required if type of scenario.
For example I have a set of radio buttons and if one is checked then I show
some more form elements all of which should be required if that radio
button is checked but not required if it is not.
Ideally, the plugin should automatically skip validation on hidden
elements, but that's not happening.

I'm thinking I'll need to do this manually but hope not.
Please advise.


Reply to this email directly or view it on GitHub
#17.

OK, now I feel dumb, didn't think of ng-required, totally fixed it for me. Sorry to bug you!

Ha no worries! Angular is a complex beast!
On 7 Oct 2014 19:31, "dsargent3220" notifications@github.com wrote:

OK, now I feel dumb, didn't think of ng-required, totally fixed it for me.
Sorry to bug you!


Reply to this email directly or view it on GitHub
#17 (comment)
.