Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

util.printd is not present in livecycle?

Avatar

Level 2

Hello, i'm trying to adapt some old script in an xdp document.

While previewing a document that should display a date in livecycle designer works well,

 

this code doesn't work in HTML mode:

 

myDate=util.printd("dd/mm/yyyy",new Date());
this.rawValue=myDate;

trying to catch the error i get: "referenceError: util is not defined"

 

How can i solve this?

 

Thank you very much

1 Accepted Solution

Avatar

Correct answer by
Employee

@AmiAdobe 

this seems to come from some external library. I am not aware that printd is supported by the XFA scripting in JS.

In FormCalc you have the DateFmt() function which would do what you want - and you could use picture clauses for your fields.

If "this" is a DateField you can set the formatting to match what you want without scripting.

Kosta_Prokopiu1_0-1626359095631.png

 

View solution in original post

3 Replies

Avatar

Correct answer by
Employee

@AmiAdobe 

this seems to come from some external library. I am not aware that printd is supported by the XFA scripting in JS.

In FormCalc you have the DateFmt() function which would do what you want - and you could use picture clauses for your fields.

If "this" is a DateField you can set the formatting to match what you want without scripting.

Kosta_Prokopiu1_0-1626359095631.png

 

Avatar

Level 2
Sorry, i marked as correct reply. It's true, but i cannot modify the original layout and field of the xdp. I need another way to use util.printd and util.scand cause both are extensively used in the xdp

Avatar

Employee
I can only assume that the XDPs contain a script object named util where the printd function is written as a JavaScript function. Can you see it? Usually at the bottom.