Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Unable to move subform when using moveInstance

Avatar

Former Community Member
Hello. I need help.



I have a four questions wrapped into (DisclosureQuestions) and this is nested in Subform1. I created a button in Subform2 to add these questions. However, when I click the button, it adds the questions right under Subform1. I am trying to move the questions to Subform2. My javascript is below. Can anyone tell me what I am doing wrong?



var oNewInstance = Subform1.DisclosureQuestions.instanceManager.addInstance(1);

var nIndexFrom = oNewInstance.index;

var nIndexTo = Subform2.index + 1;

Subform1.DisclosureQuestions.instanceManager.moveInstance(nIndexFrom, nIndexTo);



Thanks!
3 Replies

Avatar

Level 5
try adding xfa.layout.relayout(); at the end of the script and let us know the results.

Avatar

Level 5
some times just xfa.form.recalculate(1); will do it for you...try them individually and together to see which one works best. Remember any time you use relayout() that should be the last exicuting line of code in that script.

Avatar

Former Community Member
Dear Sekhar,



Thanks for the suggestions. I tried it with relayout, recalculate and with both and it still doesn't work.



do you have any other ideas?



thanks!



-ambero