Variable functions are not recognized in Acrobat Reader DC

pt20150922

22-09-2015

Using LiveCycle Designer ES4, I have created variable functions in JavaScript that I call in field events.  These functions work correctly in Adobe 11.  However, when tested in Acrobat Reader DC, these functions no longer work.  If I move the script from the function into the field event, the script works.  However, I do not want to stop using variables.  Many of these variables are long and used in many fields.  Does anyone have a fix for this issue?

Below is an example of one of the JavaScript variable functions currently being used in Adobe 11:

form1.#variables.EnterFieldFC - (JavaScript, client)

function EnterFieldFC(oField)

{

oField.border.edge.presence = "visible"

Field.border.edge.color.value = "255,0,0"

Field.borderWidth = "1.5";

}

Below is the call in the Enter field event:

EnterFieldFC.EnterFieldFC(this);

When the JavaScript Debugger is enabled in Acrobat Reader DC, an error message is displayed on entering the field stating that the function EnterFieldFC is unknown.

Accepted Solutions (0)

Answers (6)

Answers (6)

radzmar

MVP

22-09-2015

Ensure you set the scripting language in the fields enter Event to JavaScript!

If it's not, the script will fail because you cannot call JavaScript-script from a FormCalc-script and vice versa.

Magus069

MVP

22-09-2015

Anything stupid could be the issue here...

Could it be because of the missing semi-colons at the end of the first 2 lines?

Try having a different name for your function or variable...

Otherwise some debugging is needed, use the try catch statement for livecycle, this could help a lot

Handling JavaScript Exceptions

Hope this will help!

pt20150922

22-09-2015

I am sorry for the typo.  oField is already used in all of the lines.  It must not have copied correctly.  So I took a screen shot instead.

821154_pastedImage_0.png

radzmar

MVP

22-09-2015

In your script your using the parameter "Field" instead of "oField" as declared in the function head, that's why the function fails.

Correct the script into:


function EnterFieldFC(oField) {


  oField.border.edge.presence = "visible"


  oField.border.edge.color.value = "255,0,0"


  oField.borderWidth = "1.5";


}