SHARE
TWEET

Untitled

a guest Dec 29th, 2016 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form class='sign_up' action='' method='POST'>                
  2.             <input id='email' type="text" name="email" placeholder="Email">
  3.             <input id='username' type="text" name="username" placeholder="Username">
  4.             <input type="password" name="password" placeholder="Password">
  5.             <input id='registerBtn' name='registerBtn' type="submit" value="Create Account">
  6.         </form>
  7.    
  8. $(".sign_up").validate({
  9.         errorElement: 'div',
  10.         rules: {
  11.             email: {
  12.                 required: true,
  13.                 maxlength: 60,
  14.                 email: true,
  15.                 remote: {
  16.                     url: 'usernameChecker.php',
  17.                     type: 'post',
  18.                     data: {
  19.                         email: function(){
  20.                             return $("#email").val();
  21.                         },
  22.                     },
  23.                 },
  24.             },
  25.  
  26.             username: {
  27.                 required: true,
  28.                 maxlength: 15,
  29.                 alphanumeric: true,
  30.                 remote: {
  31.                     url: 'usernameChecker.php',
  32.                     type: 'post',
  33.                     data: {
  34.                         username: function(){
  35.                             return $("#username").val();
  36.                         },
  37.                     },
  38.                 },
  39.             },
  40.  
  41.             password: {
  42.                 required: true,
  43.                 minlength: 7,
  44.             }
  45.  
  46.         },
  47.  
  48.         messages: {
  49.             email: {
  50.                 required: "*Please enter your email.",
  51.                 maxlength: "*Emails should not exceed 60 characters.",
  52.                 email: "*This is not a valid email.",
  53.                 remote: "*That email is already taken."
  54.             },
  55.  
  56.             username: {
  57.                 required: "*Please enter a username.",
  58.                 maxlength: "*Username should not exceed 15 characters.",
  59.                 alphanumeric: "*Usernames should contain only letters, numbers or underscores.",
  60.                 remote: "*That username is already taken."
  61.             },
  62.  
  63.             password: {
  64.                 required: "*Please enter a password.",
  65.                 minlength: "*Your password should be at least 7 characters long.",
  66.             }
  67.         },
  68.  
  69.           submitHandler: function(form) {
  70.           $("#registerBtn").prop("disabled", "disabled");
  71.             $(form).ajaxSubmit();
  72.           }
  73.     });
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
 
Top