0

Relating to this question AngularJS multi-step form validation about each step validation form in a multi-step form I have a question.

Is it possible with the same config than the related question (I show you here to better understanding) to perform global validation in the last question?

This is my config:

<form id="myForm" name="myForm" ng-submit="processForm()" novalidate>
  <div id="myFormQuestion" ui-view class="my-form">
  </div>
</form>

Each invidivual question:

<fieldset ng-form="myQuestion1">
  <input type="text" name="myAttribute" required>
  <input type="text" name="myAttribute2" required>
  <button ng-disabled="!myQuestion1.$valid" ng-click="$ctrl.nextQuestion">Next</button>
</fieldset>

I would like to do in the last question... myForm.$valid and validate if the answers of all the questions (inputs) are valid.

Is it possible to do so or maybe is there any possibility to do in a different way?

3
  • Not possible because there only one form html present in the last step which is only for last step only. Also next step button will only enable if you provide some sort of value in input so last step will eventually have all the steps valid. Nov 12, 2018 at 19:57
  • any possibility of doing a global validation in a cleaner way?
    – mannuk
    Nov 13, 2018 at 8:21
  • You have to use ng-include or hide/show div forms for that but not possible with ui-view. Either you save the form state in localstorage or save in array or something. Nov 13, 2018 at 12:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.