Expand my Community achievements bar.

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

Script Error: Invalid property set operation

Avatar

Former Community Member

(in FormCalc)

I have a form with multiple pages.  The first two are a chart and the other 8 are diagrams.  The diagrams have number fields to input measurements taken from an inspection process.  On the chart form I have a button to populate the chart with the information from the diagrams. 

The click event of the button first retrieves the information from the diagrams and transfers them to the chart.  It then is supposed to change the font color based on whether the readings are within allowable limits (Black for good, Red for bad). 

However, when I go into the Preview PDF tab, enter test data into the diagrams, and click the populate button I get an Error to which I do not know how to correct.  I have not been able to find anything on the Internet about it. 

Any help would be greatly appreciated.  Here is what is on the error screen:

Script failed (language is formcalc; context is

xfa[0].form[0].topmostSubform[0].LHChart[0].Button1[0])

script=...

Error: Invalid property set operation; font doesn't have a default property

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I figured out the solution to my problem. 

I had code in the target fields as well as the button trying to change to font color based on the imported numbers.  I deleted the code within the target fields and left the code in the button field and everything worked out right.

Thanks again for everyone help.

View solution in original post

9 Replies

Avatar

Level 9

Probably you are using a wrong method?? Could you post the script?

Avatar

Employee

Yes. Can you post the script? The error indicates "font" doesn't have a default property, so how is font being called?

you are using formcalc, and if you are just calling the variable or the field name, the default property for every field is "value".

I am going to guess that you specified it this way,

myField.font = "Arial"; // This is invalid and will throw the error you are seeing.

It should be myField.font.typeface = "Arial" for example, which works.

So, if you are changing the font's color, the code would be

 

TextField1.font.fill.color.value

= "255,255,0";

KJ

Avatar

Former Community Member

Here is the Script that I have:

topmostSubform.LHChart.Button1::click - (FormCalc, client)

//This button is used to populate the form.

//It changes font color and determines PASS/FAIL conditions

//*********************************************************************************************************

//Retrieve the value from the respective fields for FS270 Frame.

var f = 0

while (f <= 14)

do

FS270[f] = FS270LH.FS270[f]

f = f+1

endwhile

//*********************************************************************************************************

//Retrieve the value from the respective fields for the Intercostals

var i = 0

while (i <= 1)

do

Int3[i] = IntLH.Int3[i]

Int4[i] = IntLH.Int4[i]

Int5[i] = IntLH.Int5[i]

Int7[i] = IntLH.Int7[i]

Int9[i] = IntLH.Int9[i]

Int10[i] = IntLH.Int10[i]

Int13[i] = IntLH.Int13[i]

Int31[i] = IntLH.Int31[i]

Int79[i] = IntLH.Int79[i]

Int80[i] = IntLH.Int80[i]

i = i+1

endwhile

//*********************************************************************************************************

//Retrieve the value from the respective fields for the -3/-7 Skins

var sk = 0

while (sk <= 5)

do

Skin3[sk] = SkinLH.Skin3[sk]

Skin7[sk] = SkinLH.Skin7[sk]

sk = sk+1

endwhile

//*********************************************************************************************************

//Retrieve the value from the respective fields for the -5 Skin

var skin = 0

while (skin <= 10)

do

Skin5[skin] = SkinLH.Skin5[skin]

skin = skin+1

endwhile

//*********************************************************************************************************

//Retrieve the value from the respective fields for the -29/-47 Splices

var sp = 0

while (sp <= 5)

do

Splice29[sp] = SpliceLH.Splice29[sp]

Splice47[sp] = SpliceLH.Splice47[sp]

sp = sp+1

endwhile

//*********************************************************************************************************

//*********************************************************************************************************

// Changes the font color depending on value entered

var ffont = 0

while (ffont <= 14)

do

          if ((FS270[ffont] >= 28.5) and (FS270[ffont] <= 38))

          then FS270[ffont].fontColor = "0,0,0"

          else FS270[ffont].fontColor = "255,0,0"

          endif

          font = font +1

endwhile

//*********************************************************************************************************

var ifont = 0

while (ifont <= 1)

do

          if ((Int3[ifont] >= 28.5) and (Int3[ifont] <= 38))

          then Int3[ifont].fontColor = "0,0,0"

          else Int3[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int4[ifont] >= 28.5) and (Int4[ifont] <= 38))

          then Int4[ifont].fontColor = "0,0,0"

          else Int4[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int5[ifont] >= 28.5) and (Int5[ifont] <= 38))

          then Int5[ifont].fontColor = "0,0,0"

          else Int5[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int7[ifont] >= 28.5) and (Int7[ifont] <= 38))

          then Int7[ifont].fontColor = "0,0,0"

          else Int7[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int9[ifont] >= 28.5) and (Int9[ifont] <= 38))

          then Int9[ifont].fontColor = "0,0,0"

          else Int9[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int10[ifont] >= 28.5) and (Int10[ifont] <= 38))

          then Int10[ifont].fontColor = "0,0,0"

          else Int10[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int13[ifont] >= 28.5) and (Int13[ifont] <= 38))

          then Int13[ifont].fontColor = "0,0,0"

          else Int13[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int31[ifont] >= 28.5) and (Int31[ifont] <= 38))

          then Int31[ifont].fontColor = "0,0,0"

          else Int31[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int79[ifont] >= 28.5) and (Int79[ifont] <= 38))

          then Int79[ifont].fontColor = "0,0,0"

          else Int79[ifont].fontColor = "255,0,0"

          endif

 

          if ((Int80[ifont] >= 28.5) and (Int80[ifont] <= 38))

          then Int80[ifont].fontColor = "0,0,0"

          else Int80[ifont].fontColor = "255,0,0"

          endif

 

          ifont = ifont+1

endwhile

//*********************************************************************************************************

var skfont = 0

while (skfont <= 5)

do

          if ((Skin3[skfont]>= 28.5) and (Skin3[skfont]<= 38))

          then Skin3[skfont].fontColor = "0,0,0"

          else Skin3[skfont].fontColor = "255,0,0"

          endif

 

          if ((Skin7[skfont]>= 28.5) and (Skin7[skfont]<= 38))

          then Skin7[skfont].fontColor = "0,0,0"

          else Skin7[skfont].fontColor = "255,0,0"

          endif

 

          skfont = skfont+1

endwhile

//*********************************************************************************************************

var skinft = 0

while (skinft <= 10)

do

          if ((Skin5[skinft]>= 28.5) and (Skin5[skinft]<= 38))

          then Skin5[skinft].fontColor = "0,0,0"

          else Skin5[skinft].fontColor = "255,0,0"

          endif

 

          skinft = skinft+1

endwhile

//*********************************************************************************************************

var sp = 0

while (sp <= 5)

do

          if ((Splice29[sp] >= 28.5) and (Splice29[sp] <= 38))

          then Splice29[sp].fontColor = "0,0,0"

          else Splice29[sp].fontColor = "255,0,0"

  endif

    if ((Splice47[sp] >= 28.5) and (Splice47[sp] <= 38))

          then Splice47[sp].fontColor = "0,0,0"

          else Splice47[sp].fontColor = "255,0,0"

  endif

 

          sp = sp+1

endwhile

//*********************************************************************************************************

//*********************************************************************************************************

var result = 0

while (result <= 14)

do

          if (Result[result] == "PASS")

          then Result[result].fontColor = "0,0,0"

          else Result[result].fontColor = "255,0,0"

  endif

 

          result = result+1

endwhile

Avatar

Employee

What version of Designer are you using? There is no such property called "fontColor" for the font element in the template spec.

Use this:

 

TextField1.font.fill.color.value

= "255,255,0"

That should work.

Avatar

Former Community Member

I will give that a try.  I am using Livecycle Designer ES2.

Avatar

Former Community Member

kjaeggin, I gave your solution a try and came up with the same error.

Avatar

Employee

I am not sure why that isn't working for you. It changes the font color for me using the same version of Designer, and Acrobat 9.x as the runtime.

It will be hard to debug without seeing your form.

Avatar

Former Community Member

I don't see a way to attach the form to this thread.

Avatar

Correct answer by
Former Community Member

I figured out the solution to my problem. 

I had code in the target fields as well as the button trying to change to font color based on the imported numbers.  I deleted the code within the target fields and left the code in the button field and everything worked out right.

Thanks again for everyone help.

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] ----