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

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Function Help to change many .presence


Level 2

I have a dynamic form which has multiple comments scattered among multiple pages, sometimes the form is used electronic and sometimes it is printed.  I have a dropdown field to indicate the selected current use.  The difference is the comment field changes from a single text field per section for digital use to a table with multiple rows for printing for hard copy use.  I am calling the function on my form ready and from the exit event of the dropdown field.  However the below function isn't actually changing the .presence of anything.  I would rather not have to hard code every single comment subform and text field path.  Can someone look at the function I'm trying to build and help me understand what I'm doing incorrectly?

function SetCmntMode (oNode)


// read and set the appropriate comment field/subform visibility

switch (xfa.resolveNode("frm.#pageSet[0].PageArea1.sfrmHdr.cboMethod").rawValue){

case "Digital":

  vCmntDigi = "visible";

  vCmntHard = "hidden";


case "Hard Copy":

  vCmntDigi = "hidden";

  vCmntHard = "visible";



  vCmntDigi = "visible";

  vCmntHard = "hidden";


// show the appropriate comment field/subform

var sFrmNum = xfa.resolveNodes("PrntComment"); 

  for (var i=0; i < sFrmNum.length; i++) { 

      sFrmNum.item(i).presence = vCmntDigi ; 


var sTxtNum= xfa.resolveNodes("txtComment"); 

  for (var i=0; i < sTxtNum.length; i++) { 

      sTxtNum.item(i).presence = vCmntHard ;



0 Replies