Simple Multi Step Form with validation Using AngularJS

Simple Multi Step Form with validation Using AngularJS

Simple Multi Step Form with validation Using AngularJS

In this Post We Will Explain About is Simple Multi Step Form with validation Using AngularJS With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to AngularJS Multi-Step Form Using UI Router Example

In this post we will show you Best way to implement AngularJS 1.5.x Multi-Step Form, hear for How to make multi step form in Angularjs with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

External Include file

AngularJS is a simple JavaScript framework Include one type of the (library) based on a very user friedly popular software mvc based architecture menas called the MVC.

   

index.html

The Angular simple directives and the User’s view HTML DOM in a web-application page form the HTML view. In our example(Pakainfo.com), the simple HTML view comprises the HTML All the element, and then simple two angular directives Like as a namely angular ng-app as well as agular ng-controller



  <div class="container">
    <div class="main row live">
      <div class="col-xl-12"> </div>
    </div>
    <div class="main row live">
      <div class="col-xs-12 col-sm-12 col-xl-12 col-lg-12">
        <h2>AngularJS 1.5.x Multi-Step Form</h1>
      </div>
    </div>
    <form name="StepByStepFrm" class="form-validation" role="form">
      <div class="animate-switch-container">
        <div class="animate-switch">
          <div class="main row live">
            <div class="col-xl-12">
              <p>Welcome to Pakainfo.com - the form.</p>
              <button type="button" class="btn btn-primary">Start</button>
            </div>
          </div>
        </div>
        <div class="animate-switch">
          <div class="main row live">
            <div class="col-xs-6 col-sm-6 col-xl-6 col-lg-6">
              <div class="form-group">
                <label for="tb-fname">First Name:</label>
                
                <span>
                  Max character length reached.
                </span>
              </div>
            </div>
          </div>
          <div class="main row live">
            <div class="col-xs-6 col-sm-6 col-xl-6 col-lg-6">
              <div class="form-group">
                <label for="tb-lname">Last Name:</label>
                
                <span>
                  Max character length reached.
                </span>
              </div>
            </div>
          </div>
          <div class="main row live">
            <div class="col-xs-6 col-sm-6 col-xl-6 col-lg-6">
              <div class="form-group">
                <label for="tb-email">Email:</label>
                
                <span>
                  Incorrect email format.
                </span>
                <span>
                 Please Max character length reached.
                </span>
              </div>
            </div>
          </div>
          <div class="main row live">
            <div class="col-xs-6 col-sm-6 col-xl-6 col-lg-6">
              <div class="form-group">
                <label for="tb-other-email">Other:</label>
                
                <span>
                  Incorrect Your email format.
                </span>
                <span>
                 Please Max character length reached.
                </span>
              </div>
            </div>
            <div class="col-xs-1 col-sm-1 col-xl-1 col-lg-1">
              <button type="button" class="btn btn-xs btn-warning">Add</button>
            </div>
          </div>
          <div class="main row live">
            <div class="col-xs-6 col-sm-6 col-xl-6 col-lg-6">
              <div>
              </div>
            </div>
          </div>
          <button type="button" class="btn btn-primary">Back</button>
          <button type="button" class="btn btn-primary">Next</button>
        </div>
        <div class="animate-switch">
          <div class="form-group">
            <label for="ta-body">Message Body:</label>
            <textarea class="form-control dt-lsiv" rows="5" id="ta-body"></textarea>
          </div>
          <button type="button" class="btn btn-primary">Back</button>
          <button type="button" class="btn btn-primary">Next</button>
        </div>
        <div class="animate-switch">
          <h3>Summary</h3>
          <p>First name: {{liveparam.userFname}}</p>
          <p>Last name: {{liveparam.userLname}}</p>
          <p>Email: {{liveparam.email}}</p>
          <p>Message Body: {{liveparam.messageBody}}</p>
          <button type="button" class="btn btn-primary">Back</button>
          <button type="button" class="btn btn-warning">Submit</button>
        </div>
        <div class="animate-switch">
          <div class="success-wrap">
            <h2 class="confirmation-text">Thank you</h2>
            <p>Your message has been sent.<br>You should receive a confirmation email.</p>
            <div><button type="button" class="btn btn-success">Send Another</button></div>
          </div>
        </div>
        <div class="animate-switch">
          <div class="error-wrap">
            <h2 class="confirmation-text">Error</h2>
            <p>There was an error when attempting to submit your request.<br>Please try again later.</p>
            <p><strong>*This will always error until a web service URL is set.*</strong></p>
            <div><button type="button" class="btn btn-danger">Try again</button></div>
          </div>
        </div>
      </div>
    </form>
    <div class="main row live">
      <div class="col-xs-12 col-sm-12 col-xl-12 col-lg-12"> </div>
    </div>
    <div class="main row live">
      <div class="col-xs-6 col-sm-6 col-xl-6 col-lg-6">
        <button type="button" class="btn btn-sm btn-primary">Toggle Object</button>
        <div> </div>
        <pre> {{ liveparam | json }}</pre>
      </div>
    </div>
    <div class="main row live">
      <div class="col-xs-12 col-sm-12 col-xl-12 col-lg-12"> </div>
    </div>
    <div class="main row live">
      <div class="col-xs-6 col-sm-6 col-xl-6 col-lg-6">
        <button type="button" class="btn btn-sm btn-primary">Toggle Form Errors</button>
        <div> </div>
        <ul>
          <li>Form Invalid</li>
          <li>Form Valid</li>
          <li> <strong>{{ key }}</strong> errors
            <ul>
              <li>{{ e.$name }} has an error: <strong>{{ key }}</strong>.</li>
            </ul>
          </li>
        </ul>
      </div>
    </div>
  </div>

index.js

The simple angular controller works as a all the data of the mediator between HTML views and models.

  Laravel Query Builder Join with subquery Example

'use strict';

angular.module('liveApp', [
  'ngAnimate'
]).
controller('liveCtrl', ['$scope', '$http', function($scope, $http) {
  $scope.liveparam = {};
  $scope.phase = "";
  $scope.liveValidate = false;
  $scope.btnToggleJson = false;
  $scope.generateError = false;
  
  $scope.liveparam = {
    otherEmail: '',
    otherEmailList: []
  };
  
  // Navigation functions
  $scope.next = function (phase) {
    //$scope.mulridir = 1;
    //$scope.phase = phase;
    
    $scope.liveValidate = true;
    
    if ($scope.StepByStepFrm.$valid) {
      $scope.mulridir = 1;
      $scope.phase = phase;
      $scope.liveValidate = false;
    }
  };

  $scope.back = function (phase) {
    $scope.mulridir = 0;
    $scope.phase = phase;
  };
  
  // Other email list functions
  $scope.addOtherEmail = function () {
    $scope.userRId++;

    var email = {
      email: $scope.liveparam.otherEmail,
      userrow_id: $scope.userRId
    };

    $scope.liveparam.otherEmailList.push(email);

    $scope.liveparam.otherEmail = '';
  };

  $scope.removeCCEmail = function (userrow_id) {
    for (var i = 0; i < $scope.liveparam.otherEmailList.length; i++) {
      if ($scope.liveparam.otherEmailList[i].userrow_id === userrow_id) {
        $scope.liveparam.otherEmailList.splice(i, 1);
        break;
      }
    }
  };
  
  
  // Post to desired exposed web service.
  $scope.submitForm = function () {
    var myurl = "http://pakainfo.com/";

    // Check form validity and submit data using $http
    if ($scope.StepByStepFrm.$valid) {
      $scope.liveValidate = false;

      $http({
        method: 'POST',
        url: myurl,
        data: JSON.stringify($scope.liveparam)
      }).then(function successCallback(results) {
        if (results
          && results.data
          && results.data.status
          && results.data.status === 'success') {
          $scope.phase = "success";
        } else {
          if (results
            && results.data
            && results.data.status
            && results.data.status === 'error') {
            $scope.phase = "error";
          }
        }
      }, function errorCallback(results) {
        $scope.phase = "error";
        console.log(results);
      });
    }
  };
  
  $scope.reset = function() {
    // Clean up scope before destorying
    $scope.liveparam = {};
    $scope.phase = "";
  }
}]);

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

  Add Remove multiple Input Fields Dynamically in jQuery

Angularjs multi step form validation

Multi-Step Form in Angular

I hope you have Got What is Multi Step Form with Progress Bar using Angularjs and CSS3 And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Reply

avatar
  Subscribe  
Notify of