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 Instanc
e Manager Concepts”, 1);
if (Subform3.instanceManager.count > Subform3.instanceManager.occur.min) {
Remarque :
|
ce script utilise la valeur parent.parent.index pour indiquer l’instance de Sous-formulaire3 à supprimer. La référence parent indique le conteneur de l’objet qui utilise la référence. Dans ce cas, l’utilisation de la référence parent.index indique le sous-formulaire sans titre qui contient les boutons d’ajout d’une instance au-dessous, de suppression de l’instance active, de déplacement des rangées vers le haut et de déplacement de rangées vers le bas.
|
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);