Expand my Community achievements bar.

Adobe LiveCycle Data Field

Avatar

Level 1

Hello everyone,

 

I've created a date field and I need to validate the date so that it is after 01-01-2022.

 

If the user enters a date earlier than the date, it should give an appropriate message and the value of the date field should be null.

 

Please help.

 

Thanks

 

Aitor

2 Replies

Avatar

Community Advisor

Hi @Aitor_ ,

Try this, 

var entryDate = date2num($.formattedValue, "MM/DD/YYYY")
var currentDate = date()
if (entryDate lt date()) then
$host.messageBox("Date cannot be in the past", "Date in the past", 0, 0)
else if (entryDate gt currentDate) then
//do Something
endif

Hope that helps!

Regards,

Santosh

Avatar

Level 1

Hi @SantoshSai ,

 

I have tried to apply the code but How can I specify that it only correctly validate dates from 01-01-2022?

 

Thanks a lot,

 

Aitor