Validation of hidden inputs

1,376 views
Skip to first unread message

Adam Wynne

unread,
May 16, 2012, 2:37:51 PM5/16/12
to ang...@googlegroups.com
Hi guys

Has anyone got a strategy for taking hidden inputs out of the validation of a form (i.e. when ng-hide is true)? I have some hidden fields that are preventing my form from having $valid = true

Cheers
Adam

Vojta Jína

unread,
May 24, 2012, 8:06:21 PM5/24/12
to ang...@googlegroups.com
You can use ng-switch, which removes elements from the DOM.

V.
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/wL_M2Qroj5kJ.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/angular?hl=en.

Gunbilegt Byambadorj

unread,
Jun 27, 2014, 3:41:37 AM6/27/14
to ang...@googlegroups.com
If you are using ng-show or ng-hide then add that condition to validation.

for example 

<div ng-show="isVisible">
<input ng-model="testModel" ng-required="isVisible" />
<span class="error" ng-show="testForm.testModel.$error.required && isVisible">required field</span>
</div>
Reply all
Reply to author
Forward
0 new messages