prevent date in the past

Avatar

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
rickstsx04
Level 1

05-05-2015

I am trying to prevent a date field from allowing a user to enter a date prior to the current date. How can this be done?

Accepted Solutions (0)

Answers (4)

Answers (4)

Avatar

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
rickstsx04
Level 1

Likes

2 likes

Total Posts

47 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
rickstsx04
Level 1

07-05-2015

Thank you for your help! Worked like a charm! Many thanks!

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

06-05-2015

Correct, the pattern in the script has to be the one you use to display your date.

In the US it's generally MM/DD/YYYY and in Germany it's DD.MM.YYYY

Avatar

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
mouslander
Level 4

06-05-2015

This works great. The pattern for the date field has to be set to whatever is in the script. I had my date field as MM/DD/YYYY and it would not work until I modified the formattedValue line to match the pattern for the field.

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

05-05-2015

Hi,

you can use a FormCalc script in the date fields exit event to inform the user an delete the invalid field data.


if (date2Num($.formattedValue, "DD.MM.YYYY") lt Date()) then


  if ($host.messageBox("You cannot select a date in the past", "invalid date", 0,0) eq 1) then


  $.rawValue = ""


  $host.setFocus(Ref($))


  endif


endif