Calling a Script Object after remove instance index[0]

Avatar

Avatar
Validate 10
Level 2
01371406
Level 2

Likes

5 likes

Total Posts

141 posts

Correct reply

7 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
01371406
Level 2

Likes

5 likes

Total Posts

141 posts

Correct reply

7 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
01371406
Level 2

04-05-2015

     I have created a LiveCycle document that has a repeatable subform as url linked below. The form will not let me call a Script Object after removing an instance at index[0]. Regardless of the number of instances remaining. I use a script object to show and hide buttons. Adding an instance is not a problem. What to do?

Script on Delete Subform Button (Error):

xfa.form.recalculate(1);

this.resolveNode('fifteenSubform._CorrectiveActionWrapper').removeInstance(this.parent.index);

if (xfa.host.version < 😎 {

}

//deleteing a [0] index seems to create a problem for executing the function in this Script Object

SOremove.fxremove();

https://files.acrobat.com/a/preview/03389d79-9020-45d9-ba4f-fb4cbdc21f77

Accepted Solutions (0)

Answers (3)

Answers (3)

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

07-05-2015

Hi,

What seems to happen when you remove a form object that has code that is currently executing is that it can't find the next line.  You might want to put all your code in the script object.

so in the click event you have;

SOremove.fxremove(this);

Then your script object will start

function fxremove(button) {

    button.resolveNode('fifteenSubform._CorrectiveActionWrapper').removeInstance(button.parent.index);

    if (xfa.host.version < 8) {

        xfa.form.recalculate(1);

    }

    console.println("The SOremove.fxremove fired");

Regards

Bruce

Avatar

Avatar
Validate 10
Level 2
01371406
Level 2

Likes

5 likes

Total Posts

141 posts

Correct reply

7 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
01371406
Level 2

Likes

5 likes

Total Posts

141 posts

Correct reply

7 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
01371406
Level 2

06-05-2015

Magus069 thanks for your reply. But I don't understand what you mean by adding the "ur removeInstance" to the end of the code. Could you expound or point me to a url that explains this idea?

Avatar

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,078 posts

Correct reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,078 posts

Correct reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile
Magus069
MVP

06-05-2015

Hi there,

when you work around with instances you should always put ur removeInstance at the end of your code...

Because when you remove an instance the somExpression of the object you are in, doesnt exist anymore, cuz u change the index of the object that fires the event

unless that u remove an instance that is higher than the instance you are actually in.

hope this help