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

Script Object Issues (Cannot reference my functions)

Avatar

Level 2

Hello Experts:

I'm searching for answers regarding my inability to reference my script objects from the designer's object reference drop-down (Intelliense-style).

I also recieve an obvious runtime error: ClinicalAffiliationSiteReview.variables.MyFunctions.calcTotal_SecI() is not a function [code snippet below].

I have re-installed LiveCycle (8.1.2) to no avail. My functions still do not appear.

Is this a LC configuration issue that I need to setup?

Have I overlooked some JavaScript syntax option?

Script Object should appear on the intellisense menu, right?

I believe my function declaration to be correct.

I don't think JavaScript has member access modifiers (private, public, internal)?

I have a strong C# background, but a novice at JavaScript.

Anyfeedback or comments are greatly appreciated.

Thank you for your time,

Ivan A. LoretoComputer Education Technician

LOMA LINDA UNIVERSITY | School of Allied Health Professions - Department of Physical Therapy

Form Code Snippet

Function is defined at the highest tree-level under [variables] node


ClinicalAffiliationSiteReview.#variables[0].MyFunctions - (JavaScript, client)

function calcTotal_SecI()

{

//SecI_Score is numeric field: use parseInt

CI_Info.SecI_Score.rawValue = parseInt(Student_Info.PatientLoad.Row1.StudentLoadScore1.rawValue)

    + parseInt(Student_Info.PatientLoad.Row2.StudentLoadScore2.rawValue)

    + parseInt(Student_Info.PatientLoad.Row3.StudentLoadScore3.rawValue)

    + parseInt(Student_Info.PatientLoad.Row4.StudentLoadScore4.rawValue)

    + parseInt(Student_Info.PatientLoad.Row5.StudentLoadScore5.rawValue)

    + parseInt(Student_Info.PatientLoad.Row6.StudentLoadScore6.rawValue)

    + parseInt(Student_Info.PatientLoad.Row7.StudentLoadScore7.rawValue);

    if(CI_Info.SecI_Score.rawValue != null)

    {

          //calculate average and populate number_fieldName.value

    }

.Exit event Snippet

The same call is used for all drop down events.

ClinicalAffiliationSiteReview.Student_Info.PatientLoad.Row1.StudentLoadScore1::exit - (JavaScript, client)

{

     ClinicalAffiliationSiteReview.variables.MyFunctions.calcTotal_SecI();

}

My System Info

Windows XP SP 3;

Adobe Acrobat Pro 9;

LifeCycle ES 8.1.2;

SQL Server 2008 Express (LC hotfix installed ok)

Java Version 6;Update 15.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Ivan,

The change from using Visual Studio to using Designer is like going back a couple of decades.

The intellisense doesn't work for user defined script object functions.

But you should be able to call your function using;

     MyFunctions.calcTotal_SecI();

That is with out the "ClinicalAffiliationSiteReview.variables." part.

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi Ivan,

The change from using Visual Studio to using Designer is like going back a couple of decades.

The intellisense doesn't work for user defined script object functions.

But you should be able to call your function using;

     MyFunctions.calcTotal_SecI();

That is with out the "ClinicalAffiliationSiteReview.variables." part.

Bruce

Avatar

Level 2

Bruce,

Thank you very much for your prompt response and explanation.

I can confirm that calling the function w/o the work fine.

It is even more difficult when you have concurrent projects on both environments!

The form is near completion and the next one is already drafted, LoL!

Thank you again, till next time....

Ivan A. Loreto – Computer Education Technician

LOMA LINDA UNIVERSITY | School of Allied Health Professions - Department of Physical Therapy