Expand my Community achievements bar.

basic problem

Avatar

Level 1

I am new to the product and am testing to see if it will do what I need. So far, I have not been able to get a simple process to work.

I am attempting to conditionally control the appearance of a subform with FormCalc script. I have added script to the ready:form event. The script is very simple:

form1::ready:form - (FormCalc, client)

xfa.host.messageBox(Concat("FlexField36 = ", form1..FlexField36), "Debug", 0)

if (HasValue(form1..FlexField36)) then

form1..Loan2Data.presence = "visible"

endif

if (HasValue(form1..FlexField39)) then

form1..Loan3Data.presence = "visible"

endif

This fires when I show the form in preview. However, when I run the form through a "mail merge" program to fill in the fields and then open the form in reader, the event does not fire. What am I doing wrong?
tia - marc

7 Replies

Avatar

Level 10

Hi Marc,

It looks like your object references may be the problem. There is a double fullstop inbetween the "form1" and each object.

Try:

form1.FlexField36 

Hope that helps,

Niall

Avatar

Level 10

Hi,

you can surely use .. to search for a form object.

If you want to start from the root node use always "form" not the name you gave your root node.

Try this in the layoutReady:event.

var Ref = form..FlexField36

$host.messageBox(Concat("FlexField36 = ", Ref), "Debug", 0)


if (HasValue(Ref)) then

     form..Loan2Data.presence = "visible"

else

     form..Loan2Data.presence = "invisible"

endif

Avatar

Level 1

thanks radzmar, using form vs. form1 is helpful. I have to have another person run the merge program to see if it worked. I will post my results.

Avatar

Level 10

Thanks Radzmar,

You learn something new every day - I didn't know the "form.." approach.

https://acrobat.com/#d=pZx8DPTyHcvWv*Ed2NkwJw

It seems to be a FormCalc only approach, as it throws an XML error in JavaScript.

Also if there are multiple objects with the same name (but in different subforms), it seems to use the deepest object. Not sure I fully understand the approach yet.

Thanks,

Niall

Avatar

Level 1

so, I have followed the rabbit a bit further and discovered another place to check. I am using PDFTron to perform the merge and it is taking out the script somehow. No script, no action! Thanks for your help. Off to follow another rabbit...

- marc

Avatar

Level 10

Hi Niall,

this technique is for FormCalc only and described in the Scripting Basics (page 63).

http://help.adobe.com/en_US/livecycle/9.0/LiveCycle_Designer_Scripting_Basics.pdf