Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Now you see me

Avatar

Level 1

How can I get a sub form to be visible or hidden based on the state of a checkbox

See

http://www.madera-county.com/index.php/forms-and-documents/category/8-administration-documents?downl...

I have the sub forms only show when the checkboxes are checked but when I uncheck them nothing happens.

On top of that when a user goes to save a document it resets the state of the sub forms and they are invisible again.

Can you help me work through this.

2 Replies

Avatar

Level 6

Code should look like this (FormCalc):

if ($.rawValue==1)then

yoursubform.presence="visible"

else yoursubform.presence="hidden"

endif

Avatar

Level 1

Below is what shows under the one of the two subforms that need to be able to disappear and reappear (Plus save at whatever state they are left at.)

are you saying to replace:

if ((this.resolveNode("$").rawValue == null || this.resolveNode("$").rawValue == "")) {

  this.resolveNode("Transfer").presence = "hidden";

}

with

if ($.rawValue==1)then

yoursubform.presence="visible"

else yoursubform.presence="hidden"

endif

or are you saying I should add the above code along with the rest of the code

*************************************************

(Below is the complete subform code and only for reference)

form1.Transfer.TransferFrom.Row1.NumericField5::exit - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:33702E0F-551B-4F26-AF78-682653E67C1A CRC:2217153338)

//+ Type: Action

//+ Result1: SetPresence("$Node2","hidden")

//+ Node2: form1[0].Transfer[0]

//+ Node1: form1[0].Transfer[0].TransferFrom[0].Row1[0].NumericField5[0]

//+ Condition1: NumericField("$Node1","empty","0")

//+ ActionName: NumericField5.exit

if ((this.resolveNode("$").rawValue == null || this.resolveNode("$").rawValue == "")) {

  this.resolveNode("Transfer").presence = "hidden";

}

//-

form1.Transfer.TransferFrom.FooterRow.TotalTransferFrom::calculate - (FormCalc, client)

sum(TransferFrom.Row1[*].NumericField3[*])

form1.Transfer.TransferTo.FooterRow.TotalTransferTo::calculate - (FormCalc, client)

sum(TransferTo.Row1[*].NumericField2[*])

form1.Transfer.TransferFrom.Row1.from::click - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:5ACFD8C2-5799-4CE4-BAC5-FCAAD17E25AB CRC:1191800946)

//+ Type: Action

//+ Result1: AddInstance("$Node2")

//+ Node2: form1[0].Transfer[0].TransferFrom[0].Row1[0]

//+ Node1: form1[0].Transfer[0].TransferFrom[0].Row1[0].from[0]

//+ Condition1: Button("$Node1","click")

//+ ActionName: from.click

this.resolveNode('TransferFrom._Row1').addInstance(1);

if (xfa.host.version < 8) {

          xfa.form.recalculate(1);

}

//-

form1.Transfer.TransferTo.Row1.to::click - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:B4DD0CCC-579A-45AD-9F9F-BD16D37B772A CRC:914850155)

//+ Type: Action

//+ Result1: AddInstance("$Node2")

//+ Node2: form1[0].Transfer[0].TransferTo[0].Row1[0]

//+ Node1: form1[0].Transfer[0].TransferTo[0].Row1[0].to[0]

//+ Condition1: Button("$Node1","click")

//+ ActionName: to.click

this.resolveNode('TransferTo._Row1').addInstance(1);

if (xfa.host.version < 8) {

          xfa.form.recalculate(1);

}

//-