Livecycle eg hide show objects Hiding and showing objects
The form filler can use the drop-down lists in the Presence Values area to show or hide objects. In the following diagram, the Address field is hidden and the form layout has adjusted accordingly. The Print Form button is also invisible.
Livecycle eg hide show objects2 Hiding and showing objects
case ‘Invisible’:
Subform1.presence =”invisible”;
break;
case ‘Hidden (Exclude from Layout)’:
Subform1.presence =”hidden”;
break;
default:
Subform1.presence =”visible”;
break;
}
var nSubLength = Subform1.nodes.length;
var sSelectField = fieldList.rawValue;
The following script uses the replace method to remove all of the spaces from the name of the field stored in the sSelectField variable, which allows the value of the drop-down list to match the name of the object in the Hierarchy palette:
sSelectField = sSelectField.replace(‘ ‘, ”);
This script uses a For loop to cycle through all of the objects contained in Subform1:
for (var nCount = 0; nCount < nSubLength; nCount++) {
If the current object in Subform1 is of type field and the current object has the same name as the object that the form filler selected, the following switch cases are performed:
if ((Subform1.nodes.item(nCount).className == “field”) & (Subform1.nodes.item(nCount).name == sSelectField)) {
switch(xfa.event.newText) {
case ‘Invisible’:
Subform1.nodes.item(nCount).presence = “invisible”;
break;
case ‘Hidden (Exclude from Layout)’:
Subform1.nodes.item(nCount).presence = “hidden”;
break;
default:
Subform1.nodes.item(nCount).presence = “visible”;
break;
}
}
}
var nSubLength = Subform1.nodes.length;
var sSelectButton = buttonList.rawValue;
The following script uses the replace method to remove all of the spaces from the name of the button stored in the sSelectField variable, which allows the value of the drop-down list to match the name of the object in the Hierarchy palette:
sSelectButton = sSelecButton.replace(/\s/g, ”);
This script uses a For loop to cycle through all of the objects contained in Subform1:
for (var nCount = 0; nCount < nSubLength; nCount++) {
If the current object in Subform1 is of type field and the current object has the same name as the object that the form filler selected, perform the following switch cases:
if ((Subform1.nodes.item(nCount).className == “field”) &
Subform1.nodes.item(nCount).name == sSelectButton)) {
This script uses a switch statement to handle the five presence values that a form filler can apply to button objects.
switch(xfa.event.newText) {
case ‘Invisible’:
Subform1.nodes.item(nCount).presence = “invisible”;
break;
case ‘Hidden (Exclude from Layout)’:
Subform1.nodes.item(nCount).presence = “hidden”;
break;
case ‘Visible (but Don\’t Print)’:
Subform1.nodes.item(nCount).presence = “visible”;
Subform1.nodes.item(nCount).relevant = “-print”;
break;
case ‘Invisible (but Print Anyway)’:
Subform1.nodes.item(nCount).presence = “invisible”;
Subform1.nodes.item(nCount).relevant = “+print”;
break;
default:
Subform1.nodes.item(nCount).presence = “visible”;
break;
}
}
}
Use the resetData method to reset all of the drop-down lists to their default values:
xfa.host.resetData();
Use the remerge method to remerge the form design and form data. In this case, the method effectively returns the objects in the Form Objects area to their original states:
xfa.form.remerge();

Hiding and showing objects