Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Please Help me with FormCalc Customized Text Field

Avatar

Level 2

A while ago someone online did a great thing for me- they helped me create a Text field that would type "This document was printed on _________" and include whatever day the pdf form was printed off our employer's intranet site.

I had a shortcut to it in my favorites and would click on it and plave it on every new document I needed it to be on.

Since the computer I was using suddenly crashed, I cannot find the details of how to set this up again. I have a pdf form that includes the box, but when I open it in LiveCycle, it is just blank.

This is what I saved:

<field h="8.4935mm" name="PrintedOn" w="141.0398mm" x="-0.0001mm" y="0mm" xmlns="http://www.xfa.org/schema/xfa-template/2.5/">
   <ui>
      <textEdit>
         <border hand="right" presence="hidden">
            <?templateDesigner StyleID aped0?></border>
         <margin/>
      </textEdit>
   </ui>
   <font size="18pt" typeface="Tahoma" weight="bold">
      <fill>
         <color value="221,221,221"/>
      </fill>
   </font>
   <para hAlign="center" vAlign="middle"/>
   <bind match="none"/>
   <event activity="prePrint" ref="$host">
      <script>$.rawValue = concat("This document was printed on: ", num2date(date(), DateFmt(1)));</script>
   </event>
</field>

I do not remember what to do to get this working.

I use this "Printed On" textbox ALL the time, and I need to figure out what to do to get it working again quickly.

If there is anyone who could help me, I could also send you a sample of a form that includes it- then you can see exactly what I mean.

If someone could remind me how to program this kind of thing in once again and save it in LiveCycle, then explain how I can put it on another computer as well, I would really, REALLY appreciate it.

~Chris

PS- this one as I had it set up only prints the Printed on message/date on the first page. If it could somehow print on EVERY page of the PDF without me having to click and add it to every single page individually, that would be even better... but first things first!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The script is there. If you place a new textfield on the Master Page and place the following script in the prePrint event of the field:

$ = concat("This document was printed on: ", num2date(date(), DateFmt(1)))

The language is FormCalc.

Please note that you do not need to go into the XML Source for this. Just select the textfield and open the Script Editor (from the Windows menu). Drag the bottom bar of the Editor so that you can see a few lines and then set the language to FormCalc.

Should work,

Niall

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

The script is there. If you place a new textfield on the Master Page and place the following script in the prePrint event of the field:

$ = concat("This document was printed on: ", num2date(date(), DateFmt(1)))

The language is FormCalc.

Please note that you do not need to go into the XML Source for this. Just select the textfield and open the Script Editor (from the Windows menu). Drag the bottom bar of the Editor so that you can see a few lines and then set the language to FormCalc.

Should work,

Niall

Avatar

Level 2

Great, got it working!

Now just wondering, is there any way for this to appear on every page, or would I have to place this box on every page?

I have ~20 page documents and I have had requests to have this "printed on" show up on every page, but doing so seems like ti would be very time consuming.