Avatar

Not applicable

Hello

I want to hide all blank fields but to exclude tables as it messes up the table. It hides that blank cell with the borders and the table doesn't look right.

Currently my script below works it hides all the blank fields on that page.

Is it possible to get it to exclude on tables?

Thanks to all in advance.

function hideFields(myParentObject){

 

   var allChildElements;

var intNumElements;

var currentElement;

var j;

var temp;

 

//Get all the child nodes of the parent element

allChildElements = myParentObject.nodes;

 

//Total number of element in the object

intNumElements = allChildElements.length;

 

//Loop through all the child elements

for(j=0; j< intNumElements; j++){

currentElement = allChildElements.item(j);

//If the element is another subform we'll recusively call the function again

if(allChildElements.item(j).className === "subform"){

 

//if(currentElement.layout === "table"){ }

//else{

//}

else if(currentElement.className === "subformSet"){

 

//If the objects are fields, then we will want to hide them them

else if(currentElement.className === "field"){

//Check to see if the field is a button - do not count buttons

temp = currentElement.name;

 

if (temp.substring(0,6) !== "Button"){

if (currentElement.rawValue == "" || currentElement.rawValue == null){

currentElement.presence = "hidden";

 

//Check for exclusion groups - Radio Buttons

else if(currentElement.className === "exclGroup"){

// hide the exclusion group and not the individual radio buttons

if (currentElement.rawValue === ""){

currentElement.presence = "hidden";

 

} // end of for loop

} // end function