sg1234567 Posted November 19, 2009 Report Share Posted November 19, 2009 Hi, Would anyone be kind enough to write a sample code to check/compare different dates in javascript for Caspio. Goal is to be able to compare two dates. Here is the pseudocode... Get date from date field Get todays date from newDate() object If date field < newDate() Display screen saying "date cannot be less than todays date" or what I would really like is display it next to the field in red color text else date is true end the other thing is i want to be able to call this function after the user moves focus away from the box. i am a great fan of caspio and it has done an excellent job for me so far. i hope these lose ends are doable! great job caspio team! Quote Link to comment Share on other sites More sharing options...
0 gautam.shivnani Posted December 1, 2009 Report Share Posted December 1, 2009 Hi, Your Logic for the comparison is correct. In order to get the date from the Form there are 2 scenarios:- 1) In a Results Page for a Search & Report Page [@field:FieldName] 2) In the Web form i.e. Capture Form [@InsertRecordFieldName] var myDate=[@InsertRecordDate]; var today = new Date(); if (today { alert("Today is before MyDate "); } else { alert("Today is after MyDate"); } This JavaScript was taken from http://www.w3schools.com/JS/js_obj_date.asp. We would recommend you to refer this website for JavaScript related queries Hope this helps.. Regards, Gautam S "FOCUS ON SOLUTIONS & NOT ON PROBLEMS" Gautam S Quote Link to comment Share on other sites More sharing options...
Question
sg1234567
Hi,
Would anyone be kind enough to write a sample code to check/compare different dates in javascript for Caspio. Goal is to be able to compare two dates.
Here is the pseudocode...
Get date from date field
Get todays date from newDate() object
If date field < newDate()
Display screen saying "date cannot be less than todays date"
or what I would really like is display it next to the field in red color text
else
date is true
end
the other thing is i want to be able to call this function after the user moves focus away from the box.
i am a great fan of caspio and it has done an excellent job for me so far. i hope these lose ends are doable!
great job caspio team!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.