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.

Hidden Textfields not hiding after boxes are unchecked.

Avatar

Level 2

Hello, I have a form that has multiple checkboxes in one row. I coded it so that the first two checkboxes would make the hidden text field appear when checked/clicked.. and the other three following would make it hidden when checked/clicked. (THIS WORKS). HOWEVER. What i noticed was that when i would uncheck either of the first two checkboxes(that make it appear), the field would stay there. ( i already have the form to preset the textfield to be hidden when starting off, i would like to keep it hidden unless i click on checkbox 1 or two to make it appear), I've tried an if statement where if all 5 are unchecked, the text field would remain hidden, and a while loop, but that didn't work. (i've also tried putting it in the change section of livecycle scripts instead as well.

Here is the code for Checkbox 1:

TopmostSubform.Page1.Table.Row[9].Cell[2].Paragraph.CheckBox::change - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:A6C3E174-A225-467F-8F51-1B3C31A18BF7 CRC:3443522846)

//+ Type: Action

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

//+ Node7: TopmostSubform[0].Page1[0].Table[0].Row[9].Cell[2].Paragraph[0].TextField2[0]

//+ Node6: TopmostSubform[0].Page1[0].Table[0].Row[9].Cell[3].Paragraph[0].CheckBox[0]

//+ Node5: TopmostSubform[0].Page1[0].Table[0].Row[9].Cell[2].Paragraph[0].CheckBox[0]

//+ Node4: TopmostSubform[0].Page1[0].Table[0].Row[9].Cell[5].Paragraph[0].CheckBox[0]

//+ Node3: TopmostSubform[0].Page1[0].Table[0].Row[9].Cell[4].Paragraph[0].CheckBox[0]

//+ Node2: TopmostSubform[0].Page1[0].Table[0].Row[9].Cell[7].Paragraph[0].CheckBox[0]

//+ Node1: TopmostSubform[0].Page1[0].Table[0].Row[9].Cell[6].Paragraph[0].CheckBox[0]

//+ Condition6: CheckBox("$Node6","unchecked")

//+ Condition5: CheckBox("$Node5","unchecked")

//+ Condition4: CheckBox("$Node4","unchecked")

//+ Condition3: CheckBox("$Node3","unchecked")

//+ Condition2: CheckBox("$Node2","unchecked")

//+ Condition1: CheckBox("$Node1","unchecked")

//+ ActionName: CheckBox.change, CheckBox.change, CheckBox.change, CheckBox.change, CheckBox.change, CheckBox.change

if (this.resolveNode("Cell[6].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[7].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[4].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[5].Paragraph.CheckBox").rawValue == "1" && this.rawValue == "1" && this.resolveNode("Cell[3].Paragraph.CheckBox").rawValue == "1") {

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

}

//-

TopmostSubform.Page1.Table.Row[9].Cell[2].Paragraph.CheckBox::click - (JavaScript, client)

this.resolveNode("Cell[3].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[4].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[5].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[6].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[7].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("TextField2").presence = "visible";

Granted that the rest are similar with different cell values.. but here are checkboxes 2 and three so that you can see the difference

//+ GENERATED - DO NOT EDIT (ID:A6C3E174-A225-467F-8F51-1B3C31A18BF7 CRC:3543531130)

if (this.resolveNode("Cell[6].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[7].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[4].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[5].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[2].Paragraph.CheckBox").rawValue == "1" && this.rawValue == "1") {

  this.resolveNode("Cell[2].Paragraph.TextField2").presence = "hidden";

}

//-

TopmostSubform.Page1.Table.Row[9].Cell[3].Paragraph.CheckBox::click - (JavaScript, client)

this.resolveNode("Cell[2].Paragraph.TextField2").presence = "visible";

this.resolveNode("Cell[2].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[4].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[5].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[6].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[7].Paragraph.CheckBox").rawValue = "1";

TopmostSubform.Page1.Table.Row[9].Cell[4].Paragraph.CheckBox::change - (JavaScript, client)

//+ GENERATED - DO NOT EDIT (ID:A6C3E174-A225-467F-8F51-1B3C31A18BF7 CRC:2655395653)

if (this.resolveNode("Cell[6].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[7].Paragraph.CheckBox").rawValue == "1" && this.rawValue == "1" && this.resolveNode("Cell[5].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[2].Paragraph.CheckBox").rawValue == "1" && this.resolveNode("Cell[3].Paragraph.CheckBox").rawValue == "1") {

  this.resolveNode("Cell[2].Paragraph.TextField2").presence = "hidden";

}

//-

TopmostSubform.Page1.Table.Row[9].Cell[4].Paragraph.CheckBox::click - (JavaScript, client)

this.resolveNode("Cell[2].Paragraph.TextField2").presence = "hidden";

this.resolveNode("Cell[2].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[3].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[5].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[6].Paragraph.CheckBox").rawValue = "1";

this.resolveNode("Cell[7].Paragraph.CheckBox").rawValue = "1";

0 Replies