Expand my Community achievements bar.

strange behaviour of "subform.removeInstance()"; doesn't always work

Avatar

Former Community Member
Hi,



I'm currently fiddling about with the
removeInstance-method of the subform object. I want to put an error page in my form, which I intend to remove by JavaScript, if the Acrobat-Version in use is appropriate (i.e. "7.05").



So I put together a 2-page form. The name of the first page (or subform) is "errorpage". I then put the following JavaScript code in the form's initiate-event:




form1.errorpage.occur.min = "0";

form1._errorpage.removeInstance(0);



Nothing to worry about here. It works.



BUT... if I slightly modify the aforementioned code-fragment, like:




app.setTimeOut("", 10);

form1.errorpage.occur.min = "0";

form1._errorpage.removeInstance(0);



...it no longer works!!!



Instead of
app.setTimeOut("", 10); one may also use anything else, which takes at least a certain amount of time to accomplish.



Does anyone have an idea what possibly went wrong? Is it a bug with the
removeInstance-method? Does it no longer work, if the form is already rendered?



Regards,

Steve
5 Replies

Avatar

Former Community Member
Are all these fields in the same level in the hierarchy? or exists any field inside a subform?



In this case you must use:




1 level inside:

> removeInstance(this.parent.index);




2 levels inside:

> removeInstance(this.parent.parent.index);




3 levels inside:

> ...






I hope this helps you,

Dan

Avatar

Former Community Member
Thank you, Dan.

Well, here's a screenshot:


http://img114.imageshack.us/img114/6710/lcdesignerview5re.gif



The removeInstance is called in the initialize-event of the form. Weirdly, it works, if there's no other code before the
removeInstance-call (please see code in screenshot)...



Steve

Avatar

Former Community Member
Are you getting an error in the JavaScript console? (Ctrl-J)



I don't seem to be seeing the same problem.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Chris: No I'm not getting any errors.

I'm using Acrobat 7.05. Which version do you use?



Steve

Avatar

Former Community Member
I tried it in 7.0.7. But of course I tried it in a much simpler form than your would be. So there may be something else going on that's contributing to the problem as well.



Chris

Adobe Enterprise Developer Support