Avatar

Correct answer by
Level 8

Hi Amol,

Now I'm assuming that the fields are adjusted AFTER data has been brought in (since you can't enter data into an empty field if that field is hidden!).

If that's the case copy this JavaScript code into the docReady event of your SubformA:

HideExpand(xfa.layout.w(this,"in"),Subform1.Name,Subform2.Date,Subform3.Country); //the first parameter is the width of SubformA, then rest you can add as many as you want

function HideExpand(subFormWidth/*, list of Field objects*/){
var showObjects = new Array();
for (var a=1;a<arguments.length;a++){
  if (arguments[a].isNull){
   arguments[a].presence="hidden";
  }
  else{
   arguments[a].presence="visible";
   showObjects.push(arguments[a]);
  }
}
for (a=0;a<showObjects.length;a++){
  showObjects[a].w=(subFormWidth/showObjects.length)+"in";
}
}

Kyle

View solution in original post