Skip to main content
David Healy
Inspiring
June 24, 2021
質問

I need help with Javascript in Acrobat

  • June 24, 2021
  • 返信数 1.
  • 12687 ビュー

In Acrobat I need:

  • a field “Date-2” that subtracts 2 days from a field named,“DateMAIN

Field “DateMAIN” will display the date as, “June 5, 2021”  (mmm d, yyyy)

Field “Date-2” will display the date as, “6/3/21”  (mm/dd/yy)

  • a field  “Time-330” that subtracts 3 hours and 30 minutes from a field named,“TimeMAIN

Field “TimeMAIN” will display the date as, “June 5, 2021”  (mmm d, yyyy)

Once I obtain the code do I enter it in the Custom Calculation Script window?

このトピックへの返信は締め切られました。

返信数 1

bebarth
Community Expert
Community Expert
June 24, 2021

For the Day-2 field, in validation script of the DateMAIN field place this script:

this.getField("Day-2").value=util.printd("mm/dd/yy", new Date(util.scand("mmm d, yyyy",event.value)-(1000*3600*24*2)));

The format of the DateMAIN field is "mmm d, yyyy".
I don't understand the format of both time fields are not they in a time format?
@+

David Healy
David Healy作成者
Inspiring
June 24, 2021

Which window should I enter this code into: JavaScript Debugger, Actions, Custom Calculation Script or other?

 

Attached is how it should look:

David Healy
David Healy作成者
Inspiring
June 27, 2021

Thank you!!! IT WORKS!!!


The date works fine but the time isn't. Below is a screen shot and the PDF is included. The T-415 and T-430 fields jumped to subtracting 5 hrs and 15 minutes, 5 hrs. and 30 min. with the word, “undefined” after the time entry. In InDesign I specify the fields that don't have, “Main” in the name as Read Only fields. Is that a problem?