Skip to content
This repository was archived by the owner on Aug 15, 2021. It is now read-only.
This repository was archived by the owner on Aug 15, 2021. It is now read-only.

cannot validate ng-form or sections in a form #166

@dryaner

Description

@dryaner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions