Expand my Community achievements bar.

Date Calculation in LiveCycle Designer ES4

Avatar

Level 2

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

1 Reply

Avatar

Level 10

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.