SHARE
TWEET

Untitled

a guest Oct 3rd, 2016 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <section class="global_registration" ng-app="registration" ng-controller="RegistrationController">
  2.     <form name="registration" ng-submit="register()" ngnovalidate>
  3.         <input type="text" name="username" id="username" placeholder="Username" ng-model="user.username" ng-required="true" ng-pattern="/^[a-zA-Z0-9]*$/"></br>
  4.             <p ng-show="registration.username.$touched && registration.username.$error.required">Please enter a Username!</p>
  5.             <p ng-show="registration.username.$error.pattern">Please enter a Valid Username (No special characters)!</p>
  6.        
  7.         <input type="email" name="email" id="email" placeholder="Email" ng-model="user.email" ng-required="true" ng-pattern="/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/"></br>
  8.             <p ng-show="registration.email.$invalid && registration.email.$touched">Please enter a valid email!</p>
  9.        
  10.         <input type="password" name="password1" id="password1" placeholder="Password" ng-model="user.password1" ng-required="true" ng-minlength="6"></br>
  11.             <p ng-show="registration.password1.$invalid && registration.password1.$touched">Passwords must be at least 6 characters!</p>
  12.        
  13.         <input type="password" name="password2" id="password2" placeholder="Confirm Password" ng-model="user.password2" ng-required="true" ng-minlength="6"></br>
  14.             <p ng-show="registration.password2.$invalid && registration.password2.$touched">Passwords must be at least 6 characters!</p>
  15.  
  16.         <input type="submit">
  17.     </form>
  18. </section> 
  19.  
  20.  
  21. <script>
  22. var registration = angular.module('registration');
  23. registration.controller('RegistrationController', ['$scope',
  24.     function($scope){
  25.        
  26.         $scope.register = function(){
  27.             $.ajax({
  28.                             type: "POST",
  29.                             url: 'registration_validate.php',
  30.                             data:{username, email, password1, password2 },
  31.                             success: function(data)
  32.                             {
  33.                             alert(data);
  34.                                 event.preventDefault();
  35.                             }
  36.                         })
  37.         };
  38.        
  39.        
  40.     }
  41. ]);
  42. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top