Expand my Community achievements bar.

Function Help to change many .presence

Avatar

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";

  break;

case "Hard Copy":

  vCmntDigi = "hidden";

  vCmntHard = "visible";

  break;

default:

  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