Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

I am wondering what an "if" script would look like with multiple conditions?

Avatar

Level 2

I have a dynamic form and I'm trying to have certain sub forms open up but only if certain conditions are met. In addition, some of these conditions tend to be complex, for instance:

if this drop down is selected in a subform at the beginning of the form

and

this radio box is selected in a subform somewhere in the middle of the form

and

and a check box is selected in a subform somewhere else in the form

Based that, I need a subform or multiple subforms to open on a completely different page.

Is that possible? The action builder in Designer 9 is a bit confusing because for every selection that causes an action I need something to reset the action when the selection is deselected. (if that makes any sense) It is all becoming too complicated to keep together.

THanks in advance!

4 Replies

Avatar

Level 7

In formcalc it would be something like this, in the layout.ready field of the subform that you want to show if the conditions are met:

if (DropDownList1.rawValue == 1 and CheckBox1.rawValue == 1 and RadioButtonList.rawValue == 1) then

    $.presence = "visible"

else $.presence = "hidden"

endif

obviously you need to change the names of the dropdownlist, checkbox etc to whatever you have called them and the value '1' to whatever option you want the user to choose to make this happen. Just make sure in the drop down list and radio buttons you have 'Specify Item Values" ticked in the binding box.

Avatar

Level 2

So youre saying it should be in the Layout.Ready action?

ive seen some people put it in the calculate action. Will this work?

Avatar

Level 2

Also, would it look the same in Javascript?

Avatar

Level 7

the logic will be the same but the syntax is different in javascript.