if (advanced.Subform3.instanceManager.count ==
advanced.Subform3.instanceManager.max) {
xfa.host.messageBox(“You have reached the maximum number of items
allowed.”,”Combining Instance Manager Concepts”, 1);
advanced.Subform3.instanceManager.addInstance(1);
if (advanced._Subform3.count == advanced._Subform3.max) {
xfa.host.messageBox(“You have reached the maximum number of items
allowed.”, “Combining Instance Manager Concepts”, 1);
advanced._Subform3.addInstance(1);
if (advanced.Subform3.instanceManager.count == 0) {
xfa.host.messageBox(“There are no subform instances to remove.”,
“Combining Instance Manager Concepts”, 1);
advanced.Subform3.instanceManager.removeInstance(0);
if (advanced._Subform3.count == 0) {
xfa.host.messageBox(“There are no subform instances to remove.”,
“Combining Instance Manager Concepts”, 1);
advanced._Subform3.removeInstance(0);
if (Subform3.instanceManager.count < Subform3.instanceManager.occur.max) {
var oNewInstance = Subform3.instanceManager.addInstance(1);
var nIndexFrom = oNewInstance.index;
var nIndexTo = Subform3.index + 1;
Subform3.instanceManager.moveInstance(nIndexFrom, nIndexTo);
xfa.host.messageBox(“You have reached the maximum number of items
allowed.”, “Combining Instance Manager Concepts”, 1);
if (_Subform3.count < _Subform3.occur.max) {
var oNewInstance = _Subform3.addInstance(1);
var nIndexFrom = oNewInstance.index;
var nIndexTo = Subform3.index + 1;
_Subform3.moveInstance(nIndexFrom, nIndexTo);
xfa.host.messageBox(“You have reached the maximum number of items allowed.”, “Combining Instance Manager Concepts”, 1);
if (Subform3.instanceManager.count > Subform3.instanceManager.occur.min) {
Note:
|
This script uses the value parent.parent.index to indicate the Subform3 instance to remove. The parent reference indicates the container of the object using the reference. In this case, using the reference parent.index would indicate the untitled subform that contains the Add Instance Below, Delete This Instance, Move Row Up, and Move Row Down buttons.
|
Subform3.instanceManager.removeInstance(parent.parent.index);
xfa.host.messageBox(“You have reached the minimum number of items
allowed.”, “Combining Instance Manager Concepts”, 1);
if (_Subform3.count > _Subform3.occur.min) {
Subform3.removeInstance(Subform3.index);
xfa.host.messageBox(“You have reached the minimum number of items allowed.”,
“Combining Instance Manager Concepts”, 1);
if (Subform3.index != 0) {
var nIndexFrom = Subform3.index;
var nIndexTo = Subform3.index – 1;
Subform3.instanceManager.moveInstance(nIndexFrom, nIndexTo);
xfa.host.messageBox(“The current item cannot be moved because it is the
first instance in the list.”, “Combining Instance Manager Concepts”, 1);
if (Subform3.index != 0) {
var nIndexFrom = Subform3.index;
var nIndexTo = Subform3.index – 1;
Subform3.moveInstance(nIndexFrom, nIndexTo);
xfa.host.messageBox(“The current item can’t be moved since it already is the first instance in the list.”, “Combining Instance Manager Concepts”, 1);
if ((nIndex + 1) < Subform3.instanceManager.count) {
// nIndexFrom and nIndexTo store the before and after index values to use with the moveInstance() method.
var nIndexTo = nIndex + 1;
Subform3.instanceManager.moveInstance(nIndexFrom, nIndexTo);
xfa.host.messageBox(“The current item cannot be moved because it is the last
instance in the list.”, “Combining Instance Manager Concepts”, 1);
var nIndex = Subform3.index;
if ((nIndex + 1) < Subform3.instanceManager.count) {
var nIndexTo = nIndex + 1;
_Subform3.moveInstance(nIndexFrom, nIndexTo);
xfa.host.messageBox(“The current item can’t be moved since it already is the
last instance in the list.”, “Combining Instance Manager Concepts”, 1);