Advertisement
Guest User

Untitled

a guest
May 27th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. function validate() {
  2. var keyid = document.getElementById('KeyID').value;
  3. var vcode = document.getElementById('VerificationCode').value;
  4. var numberpattern = /[a-z,A-Z,!,@,#,$,%,^,&,*,(,),~,]/;
  5. var vcodepattern = /[!,@,#,$,%,^,&,*,(,),~,]/;
  6.  
  7. if (keyid.length == 0){
  8. alert("Please enter a Key Id!");
  9. return false;
  10. }
  11. if (keyid.length != 7){
  12. alert("Please enter a Key Id with a length of 7!");
  13. return false;
  14. }
  15. if (numberpattern.test(keyid)){
  16. // numbers only
  17. alert("Please enter a Key Id with only Numbers!");
  18. return false;
  19. }
  20. if (vcode.length == 0){
  21. alert("Please enter a Verification Code!");
  22. return false;
  23. }
  24. if (vcode.length != 64){
  25. alert("Please enter a Verification Code with a length of 64!");
  26. return false;
  27. }
  28. if (vcodepattern.test(vcode)){
  29. // numbers and letters only
  30. alert("Please enter a Verification Code with only Letters and Numbers!");
  31. return false;
  32. }
  33. alert("success");
  34.  
  35. return true;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement