Date Calculation in LiveCycle Designer ES4

Avatar

Avatar
Level 1
saugata74
Level 1

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
saugata74
Level 1

Likes

0 likes

Total Posts

10 posts

Correct reply

0 solutions
View profile
saugata74
Level 1

03-10-2017

Hi,

I have created a form comprising of two Date fields, date_required and date_implemented. Now, there is a validation check on date_implemented field. It is that the date_implemented field can accept dates that are 10 days after the date_required field. Else error will be displayed and focus should be on date_implemented field. Also, the form cannot be saved till all validations in the form are successfully passed. Further, there is a Days field that displays number of days elapsed between date_required and date_implemented. Please provide with requisite code both in JavaSript and FormCalc.

Rgds,

S Banerjee

Accepted Solutions (0)

Answers (1)

Answers (1)

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-10-2017

On the exit event of date_implemented add the following FormCalc script.

var datePattern = "MM/DD/YYYY"

if (Date2Num($.formattedValue, datePattern) - Date2Num(date_required.formattedValue, datePattern) gt 10) then

    $host.messageBox("Warning massage …")

    $ = null

    $host.setFocus($.somExpression)

endif

Keep in mind, that you cannot suppress saving a form in any case.