Jump to content
  • 0

date validation




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


date is true


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

  • 0


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


2) In the Web form i.e. Capture Form


var myDate=[@InsertRecordDate];

var today = new Date();

if (today


alert("Today is before MyDate ");




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..


Gautam S


Gautam S

Link to comment
Share on other sites

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.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...