Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Repeatable subform length lost?

Avatar

Level 3

I have this code in the click event of a "Delete" button within a repeatable subform:

var SFArray = xfa.resolveNodes("SubForm[*]"); //  build array of subforms

xfa.host.messageBox("length=" + SFArray.length);

if (_SubForm.count > _SubForm.occur.min) { // check for minimum

     _SubForm.removeInstance(SubForm.index); // remove requested instance

} // end if

var SFArray = xfa.resolveNodes("SubForm[*]");

xfa.host.messageBox("newlength=" + SFArray.length);

At execution I get length=3 (for example), then newlength=0 following the removeInstance

I don't understand why the 2nd resolveNodes produces length=0 and following code using the array fails with "index out of bounds"

Thanks for any help!

1 Accepted Solution

Avatar

Correct answer by
Level 3

I also tried taking the 'var' out of the 2nd resolveNode statement with no change in results.

Thanks

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3

I also tried taking the 'var' out of the 2nd resolveNode statement with no change in results.

Thanks