added validation for maxLength
This commit is contained in:
		
							parent
							
								
									e748d8f849
								
							
						
					
					
						commit
						e9a4ff8f9a
					
				@ -71,7 +71,7 @@
 | 
			
		||||
          </label>
 | 
			
		||||
        </div>
 | 
			
		||||
        <!-- <button class="dap-full-button-green js-remember-btn js-authz-remember-me">SIGN IN ONCE</button> -->
 | 
			
		||||
        <button type="submit" class="btn btn-primary submit-btn dap-full-button-green js-remember-btn js-authz-remember-me">Submit</button>
 | 
			
		||||
        <button type="submit" class="btn btn-primary submit-btn dap-full-button-green js-remember-btn js-authz-remember-me" disabled>Submit</button>
 | 
			
		||||
        <!-- <a href="./authnocode.html" target="_blank" class="btn btn-primary">Send Code Again</a> -->
 | 
			
		||||
        <button class="btn btn-primary js-edit-email-button" type="button">Edit My Email</button>
 | 
			
		||||
      </form>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										48
									
								
								js/script.js
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								js/script.js
									
									
									
									
									
								
							@ -69,28 +69,32 @@ $('body').on('click', '.js-auth-li-enabled', function (ev) {
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// $('body').on('keyup keypress', '.js-authn-otp-code', function (e) {
 | 
			
		||||
//   'use strict';
 | 
			
		||||
//   var keyCode = e.keyCode || e.which;
 | 
			
		||||
//   var regex = new RegExp('^[0-9 \-]+$');
 | 
			
		||||
//   var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
 | 
			
		||||
//   var oauthCode = $(this).val().split('-').join('').replace(/\s/g, '');
 | 
			
		||||
//
 | 
			
		||||
//   if (!regex.test(key)) {
 | 
			
		||||
//      event.preventDefault();
 | 
			
		||||
//      return false;
 | 
			
		||||
//   }
 | 
			
		||||
//
 | 
			
		||||
//   if (oauthCode.length > 0) {
 | 
			
		||||
//     oauthCode = oauthCode.match(new RegExp('.{1,4}', 'g')).join("-");
 | 
			
		||||
//   }
 | 
			
		||||
//
 | 
			
		||||
//   $(this).val(oauthCode);
 | 
			
		||||
//
 | 
			
		||||
//   if($(this).val().length === $(this).attr("maxlength")){
 | 
			
		||||
//     $('.submit-btn').prop("disabled", false);
 | 
			
		||||
//   }
 | 
			
		||||
// });
 | 
			
		||||
$('body').on('keyup keypress', '.js-authn-otp-code', function (e) {
 | 
			
		||||
  'use strict';
 | 
			
		||||
  // var keyCode = e.keyCode || e.which;
 | 
			
		||||
  // var regex = new RegExp('^[0-9 \-]+$');
 | 
			
		||||
  // var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
 | 
			
		||||
  // var oauthCode = $(this).val().split('-').join('').replace(/\s/g, '');
 | 
			
		||||
  //
 | 
			
		||||
  // if (!regex.test(key)) {
 | 
			
		||||
  //    event.preventDefault();
 | 
			
		||||
  //    return false;
 | 
			
		||||
  // }
 | 
			
		||||
  //
 | 
			
		||||
  // if (oauthCode.length > 0) {
 | 
			
		||||
  //   oauthCode = oauthCode.match(new RegExp('.{1,4}', 'g')).join("-");
 | 
			
		||||
  // }
 | 
			
		||||
  //
 | 
			
		||||
  // $(this).val(oauthCode);
 | 
			
		||||
  //
 | 
			
		||||
  // if($(this).val().length === $(this).attr("maxlength")){
 | 
			
		||||
  //   $('.submit-btn').prop("disabled", false);
 | 
			
		||||
  // }
 | 
			
		||||
  if ($(this).val().length === 14) {
 | 
			
		||||
    $('.submit-btn').prop('disabled', false);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
$('.js-authn-otp-code').mask('####-####-####');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user