Skip to Content
0
Former Member
Mar 03, 2011 at 04:41 PM

Hide subform without absolute path.

28 Views

Hi All,

I have a form design with several subforms, I get the a $ separated subform names list in a hidden field which I need to hide them. I had the below recursive function. But if for example there are 100 subforms and I have 5 subforms to hide it runs 500 times.

if somebody can help me with a simple method if any which does this work and is more efficient.

var lv_sflist = form1.ParentX.SFLIST.rawValue;
	lv_sflist = lv_sflist.toUpperCase();
	lv_sflistArray = lv_sflist.split("$");

for(var i=0; i<lv_sflistArray.length; i++){
	ProcessAllFields(this,lv_sflistArray<i>);
}
function ProcessAllFields(oparent,osubform) 
{ 
 	if (oparent.className == "subform") 
	{
		if(oparent.getAttribute("name").toUpperCase() == osubform){
			oparent.presence = "hidden";
		}else{
	  		for (var i = 0; i < oparent.nodes.length; i++) 
	  		{ 
	   			var oChildNode = oparent.nodes.item(i);
	   			ProcessAllFields(oChildNode,osubform); 
	  		} 
	 	}
	} 
}

Thanks in Advance,

cheers,

sai