day in the past



created a field in a form requestdate which is a date field. Now i want to prevent that people select a day in the past and thus generate a message telling the user: You cannot select a date in the past, please select a proper date. I think i need to do that using a validator, but i am not sure whether there is something like "current_date" or "today" to indicate that requesteddate<current_date (or today)... Any ideas? thnx emveha


Submitted by yannick.lombardi on Wed, 08/20/2014 - 15:59

Hi, You can use this code :

  1. Date today = new Date(); //It is automatically set to the current date
  2. return !(requestedDate.getTime() < today.getTime());
Submitted by emveha on Thu, 08/21/2014 - 09:58

Hi Yannick,

while trying your suggested solution, the system is telling me that there is an issue: "today cannot be resolved. It may lead to runtime error". Any idea what is going wrong?? thnx

Submitted by emveha on Fri, 08/22/2014 - 10:16

if i use this script the system tells me: Today cannot be resolved. It may lead to runtime errors. Any ideas how to solve this thnx

No answers yet.