These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Can this be accomplished with an if statement?

bctflex
Registered: Aug 8 2008
Posts: 37
Answered

Hi, I have three (3) date fields {DateEmployed},{DateofAccident}, and{DateReported}. I would like to make sure the {DateofAccident} value is not entered as a date later than the {DateReported} value. The {DateEmployed} value should be before the {DateofAccident} value and the {DateReported} value should be after the {DateofAccident} value. I am trying to prevent common data entry typing errors.

Thanks

My Product Information:
LiveCycle Designer, Windows
aerokhin
Registered: Jun 27 2008
Posts: 39
Hi,

Enter a validation Javascript script for fields. Select field, than in Script Editor (Ctrl-Shift-F5) choose validation event and Javascript language.
For DateEmployed field script should be like this:
(DateEmployed.rawValue
DanielKunz
Registered: Jan 22 2008
Posts: 55
Hi, yes you can do this with an script like this:
if((DateEmployed.rawValue <= DateofAccident.rawValue) && (DateofAccident.rawValue <= DateReported.rawValue) && (DateEmployed.rawValue <= DateReported.rawValue))
{
Everything is OK
}
else
{
Error
}

If you want to know where's the error, you only have to nest the compares I made into one if statement.

I hope I could help you.

Greets Daniel
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Since the date values are strings the comparisons will be by string value and not the actual number of days from an Epoch date. You may need to use either ISO date format or convert your string date to the number of days from LiveCycle Designer's Epoch date.

George Kaiser

bctflex
Registered: Aug 8 2008
Posts: 37
:lol: Thanks for the support. I implemented the first suggestion and it was sufficient.