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

Creating a conditional click event

Avatar

Level 3

Hello all,

I am creating a form in Livecycle Designer ES2. I am trying to create a template of sorts, so that users can fill out information within the form and it will adhere to a specific format and style. I am doing this by adding buttons that show/hide fields for text, bulleted lists, tables, images, etc. The issue that I have run into is figuring out what to hide and what to show. For instance, if a user clicks a button titled "Add image below" then an image will be shown below, the "Add image below" button is hidden, and a "Remove image" button is shown.

Is there a way to add conditional "if" statements using javascript to a button that contains a click event? My goal is for the script to evaluate whether a condition is true or false (in this case whether or not a field is already visible) and then perform one of two actions. The reason for this is that I am creating a bulleted list (that can be shown or hidden) that is followed by image fields (which can also be shown or hidden). If the user removes the image fields and there is no bulleted list shown, I want a button to be visible so the user can add a bulleted list. But if the user has already added the bulleted list, then when they remove the image fields I do not want the "Add bulleted list" button to reappear.

Is this possible?

1 Reply

Avatar

Level 10

You can verify if an object is visible or hidden

if (this.resolveNode("Reference_Syntax").presence == "visible"){

    

} else if(this.resolveNode("Reference_Syntax").presence == "hidden"){

    

}