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

Unable to move subform when using moveInstance

Not applicable
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
_SekharN_
Level 5
Level 5
try adding xfa.layout.relayout(); at the end of the script and let us know the results.
_SekharN_
Level 5
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.
Not applicable
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