Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Scope/reference problem following removeInstance?

Avatar

Level 3

This is related to my other post on removeInstance. It appears there is some other/bigger problem.

To start over: I have a repeatable subform with Add and Delete buttons. After clicking on either button, I want to total a particular numeric field from each existing subform (I know this isn't necessary for an Add event but bear with me). I have put the totaling code in a Function (DoTotal) within a Script Object  (named Locals) so its common code.

Upon Add Click:

     addInstance();

     Locals.DoTotal(); // Works Fine!

Upon Delete Click

     removeInstance(integer);

     Locals.DoTotal(); // JS Debugger says "Locals is not defined"

Thanks for any ideas!

3 Replies

Avatar

Level 3

Another observation to this question:

I have a script within the indexChange event. The script code is executed every time I click the Add button within any instance of the repeatable subform and almost every time I click the Delete (removeInstance) button.

The indexChange does NOT fire when I click Delete on the last/most recently created instance of the subform.

Is this normal??? I can't find any documentation to describe this behavior.

If someone could point me to the correct documentation I would sure appreciate it

Thanks!!

Avatar

Level 10

Yes, the help of Designer states "Keep in mind that the indexChange event does not fire when deleting the last row of a table.".

As a table nothing else as a set of subforms, this behavior also takes effect for regular subforms.

Link:

http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000764.html