Guest User

Untitled

a guest
Jan 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. function CheckDOB(DOB)
  2. {
  3. var d = new Date();
  4.  
  5. var curr_date = d.getDate();
  6. var curr_month = d.getMonth();
  7. var curr_year = d.getFullYear();
  8.  
  9. var dobDate = new Date(DOB);
  10. var dobDay = dobDate.getDate();
  11. var dobMonth = dobDate.getMonth();
  12. var dobYear = dobDate.getFullYear()
  13.  
  14. DOB = new Date(dobDay, dobMonth, dobYear );
  15.  
  16. console.log("DOB: " + DOB);
  17.  
  18. var today = Date(curr_date, curr_month, curr_year);
  19.  
  20. console.log("Today: "+ today);
  21.  
  22. if (DOB >= today)
  23. {
  24. console.log("in false");
  25. alert("Date of Birth cannot be greater than today.");
  26. alert = function(){};
  27. return false;
  28. }
  29. else
  30. {
  31. console.log("in true");
  32. return true;
  33. }
  34. }
  35.  
  36. function txtCompPersonDOB_OnChange()
  37. {
  38. var DOB = CSForm.getField('txtCompPersonDOB').getValue();
  39. //console.log(DOB);
  40.  
  41. if(CheckDOB(DOB))
  42. {
  43. console.log("test on change: false")
  44. CSForm.getField('txtCompPersonDOB').setFocus();
  45. }
  46. else
  47. {
  48. console.log("test on changeL true");
  49. }
  50.  
  51. }
Add Comment
Please, Sign In to add comment