Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

how do I add "code" to field...

Avatar

Former Community Member

I'm lost here, I use LiveCycle Designer ES and I'm trying to fix few fields to interact with each other in pdf. I've studied few examples, calculation field has marked in value tab "Calculated - Read Only" and code is added in Script editor (Ctrl+Shift+F5)

What I am trying to do is add two numbers inserted by user and display score in third field. I've created 3 "Numeric Fields" named:

NumericField1

NumericField2

NumericField3

last ones value is set to "Calculated- Read Only".

I mark last field and go to script editor (ctrl+shift+f5 or window->script editor)

there I set language for Java Script (which is enabled btw) and I put either seen in some AA9pro examples (like holidays chart)

Sum(NumericField1, NumericField2);

or seen in adobe javascript tutorial

var f = this.getField("NumericField1");

var g = this.getField("NumericField2");

event.value = f.value + g.value;  //or NumericField3 instead of event.value

none of these couses any errors in syntax checker and none of this works. What do I do wrong?

Please advice.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi

Let Val1 , val2, Val3 are three Numeric fields  fields .

then script Editor ,

In Javascript ,

val3.rawValue = val1.rawValue + val2.rawValuwe ;

thats it . Try Good Luck .

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

Hi

Let Val1 , val2, Val3 are three Numeric fields  fields .

then script Editor ,

In Javascript ,

val3.rawValue = val1.rawValue + val2.rawValuwe ;

thats it . Try Good Luck .

Avatar

Level 10

Since you set the 3rd Numeric field value to Calculated-Read Only, then you should place your code in the Calculate event of the 3rd Numeric field.

Try placing the below line of code in the Calculate event and set the language to FormCalc instead of Java script in the Script window. (Sum is a function supported in FormCalc).

Sum(NumericField1, NumericField2);

Thanks

Srini

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----