Expand my Community achievements bar.

Script editor - validating a date field's value - UPDATED

Avatar

Level 1

Hi there,

I'm trying to achieve a (hopefully!) simple data validation on a date field but can't quite seem to get it right.

I have a date field on a form that I have set to automatically populate with the current day's date each time the form is opened.  In another date field that a user selects, I do not want them to be able to choose the same date as the auto-populated one.  If they do I want an error message to display saying "Date must be at lease 24 hours after original date" or something to that effect.  They should not be allowed to print or email the form if the second date is the same as the first.

So far I have tried using the following script but it doesn't seem to be working how I'd like it to:

if (Date2.rawValue == Date1.rawValue) then

xfa.host.messageBox ("Pick up date must be at least 24 hours after request date")

endif

I'd be grateful if anyone could point me in the right direction!

Thanks,

Georgie

________________________________________________________________________________________________

UPDATE

I managed to find this helpful instruction sheet online which tells me exactly how to achieve what I needed (minor changes required).  If anyone else is looking to do the same thing the link is below.

http://library.albany.edu/imc/pdf/LiveCycle_prevent_selecting_date_before_today.pdf

0 Replies