jpkleemans / angular-validate

Painless form validation for AngularJS. Powered by the jQuery Validation Plugin.
MIT License
68 stars 33 forks source link

How to validate hidden fields with this plugin #26

Open harishnagi007 opened 6 years ago

harishnagi007 commented 6 years ago

Well, I have a hidden field in my form and trying to validate the ui-select element. On submit it shows the error label, but when the hidden fields gets it value from the ng-model, the error is still shown and also i am not able to submit the form.

Here's the html

<ui-select ng-model="noPostData.locaopt.id" theme="selectize">
   <ui-select-match placeholder="Select Location">{{$select.selected.name}}</ui-select-match>
          <ui-select-choices repeat="obj.id as obj in locaoptions | filter: {name: $select.search}">
                  <div ng-bind-html="obj.name | highlight: $select.search"></div>
            </ui-select-choices>
</ui-select>
<input type="hidden" name="subloc_loca" ng-model="noPostData.locaopt.id">

Here's the options

 $scope.validationOptions={
        ignore: [],
        rules: {
           subloc_loca: {
                required: true
            }
}

If the hidden field is getting its value from ng-model, why the error label is not going away. Why is this happening and how can i achieve this. Please help me