Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CheckDOB(DOB)
- {
- var d = new Date();
- var curr_date = d.getDate();
- var curr_month = d.getMonth();
- var curr_year = d.getFullYear();
- var dobDate = new Date(DOB);
- var dobDay = dobDate.getDate();
- var dobMonth = dobDate.getMonth();
- var dobYear = dobDate.getFullYear()
- DOB = new Date(dobDay, dobMonth, dobYear );
- console.log("DOB: " + DOB);
- var today = Date(curr_date, curr_month, curr_year);
- console.log("Today: "+ today);
- if (DOB >= today)
- {
- console.log("in false");
- alert("Date of Birth cannot be greater than today.");
- alert = function(){};
- return false;
- }
- else
- {
- console.log("in true");
- return true;
- }
- }
- function txtCompPersonDOB_OnChange()
- {
- var DOB = CSForm.getField('txtCompPersonDOB').getValue();
- //console.log(DOB);
- if(CheckDOB(DOB))
- {
- console.log("test on change: false")
- CSForm.getField('txtCompPersonDOB').setFocus();
- }
- else
- {
- console.log("test on changeL true");
- }
- }
Add Comment
Please, Sign In to add comment