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

Livecycle Javascript Date Calculation

captainkalt
Registered: Jun 18 2008
Posts: 8

I'm trying to find out how to have a function in Adobe Livecycle that will show the last date revised on the form. I want the form to update the revision date only when the form is updated via livecycle. For example:

Last Revised: 10/20/09

If anyone can help with this that would be great.

Thanks

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You can create a date/time field with following FormCalc-script.
if ($.rawValue==null)then$.rawValue = Num2Date(date(), "MM.DD.YYYY")else$.rawValueendif

If you the then set the field to "protected", it can't be canged by a user.

The script will will populate the field with the date on that the form has been opened the first time.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

captainkalt
Registered: Jun 18 2008
Posts: 8
awesome man thanks a million worked perfect
captainkalt
Registered: Jun 18 2008
Posts: 8
The above worked but now I am having a different issue. We have several javascript functions within the same form and whenever one of the functions is activated by the user the date goes blank and will save as the date the user updated the form as. Like I said earlier I would like the date function to only update when someone is updating the form via livecycle. Is there anyway to achieve this without other javascript functions interfering with the date/time. Thanks in Advance for any help
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well, if there is a reset script somewhere in the form, then the script above will be executing again after the reset.

An alternative is the timeStamp property.
With the script in a form:ready event in a write protected text field, the date and time when the form has been saved by Designer is shown.
The time stamp is written in the form header by Designer and can't be changed by a script within the form.

this.rawValue = xfa.timeStamp;
If you only need the date, you can cut the time stamp with the following FormCalc-script.

this.rawValue = Left(xfa.timeStamp, 10)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs