angular-auto-validate
angular-auto-validate copied to clipboard
cannot validate ng-form or sections in a form
I have a form divided in several tabs with fieldset. Before change to the next tab I want to validate the fieldset of the curret tab. For that I'm trying to use the ng-form directive and the function validateForm with a function like this one
$scope.validateNext = function (fieldset, nextTab) { if(validationManager.validateForm(document.querySelector('[name='+fieldset+']'))){ // $location.path("/events/event/view"); $state.go(nextTab); } };
I'm obtaining this error.
Cannot read property 'elements' of undefined
I know that it's because the fieldset with a ng-form have the form controller but don't have the DOM elements of the form.
Exist a way to do this? If not. that will be a really good improvement in this plugin for validate big forms.
Here it's a simplified plunk with the error
http://plnkr.co/edit/NQCuDpccwckswy4rTHY8?p=preview