Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Script Error: Invalid property set operation

dherberger
Level 2
Level 2

(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
dherberger
Correct answer by
Level 2
Level 2

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
Bibhu_Bikash_Na
Level 9
Level 9

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

kjaeggin
Employee
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

dherberger
Level 2
Level 2

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

kjaeggin
Employee
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.

dherberger
Level 2
Level 2

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

dherberger
Level 2
Level 2

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

kjaeggin
Employee
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.

dherberger
Level 2
Level 2

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

dherberger
Correct answer by
Level 2
Level 2

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