Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

What is the proper syntax for adding an if statement to control presence settings?

Avatar

Level 2

I am new to FormCalc and JavaScript, but I have been trying to do some reasearch and some different syntax.  I have an image field inserted into a subform.  I am trying to have this subform's presence setting adjusted based on a field located somewhere else on the form.  I have been able to get the subform to become hidden based on other fields located on the form, but not with the one I need.  The field is working because it is loading the data correctly with the print tests.  My thought is that I am calling this field value incorrectly for the if statement.

Show:  Events with Scripts

Language: FormCalc

 

data.#pageSet[0].Page1.Logo::validate - (FormCalc, client)

if

(data.Page1.Header.ZWZART.rawValue == CU)

then

LOGO.presence

= "hidden"

endif

The subform is called (Logo), and I have setup an image field that contains my embedded graphic file.  The graphic field is called LOGO (I know matching names is not the best idea).

I do not receive any syntax errors when checking.

Basically I am tryin gto check the HideField to see is it equals XA, and if it does I hide the subform, but more importantly the graphic.

I have added another text field into this subform and referenced the field I want fromthe context tab to make sure it is populating correctly there as well, and it is.  I have since changed that presence to hidden incase it will be helpful to use.

I have tried looking around, but I am mostly finding examples linking to user entered, or selected fields.  This field get automatically generated at the time of creation.  The user does not drive this answer, and it does not get changed, so it does not need to be updated.

Thank you in advance for any pointers you may have.

1 Reply

Avatar

Level 2

the problem may be that you have to reference the object not just by name. It would need to be referenced by its name in association to the object where the script is placed. Livecycle designer has a handy tool(I hope for your version as well). if you(while writing script) ctrl+click the object you want to point to, it will automatically populate its correct name needed for referencing from the object being scripted. I hope this can help.