Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

addInstance Issue

Avatar

Former Community Member
I am trying to get a better feel for the instanceManager.addInstance function. I have a very simple form setup, with the hierarchy properly created...and a button with the click funciton of



xfa.form.tasks.page1.task.instanceManager.addInstance(true);



The button at the moment doesn't do anything. When I look at the debugger it tells me the following...



GeneralError: Operation failed.

XFAObject.addInstance:1:XFA:tasks[0].page1[0].addTaskbtn[0]:click

The element [max] has violated its allowable number of occurrences.



How do I address this? Thanks as always for the help!

It seems like I'm missing something really basic. But I'm no expert when it comes to JS.
6 Replies

Avatar

Former Community Member
Karl,



Try setting the min/max instance fields for your subform. This will be in the binding tab for the subform.



Catherine

Adobe Systems

Avatar

Former Community Member
Not sure if this helps, the subform that contains the info that will be repeated, when the button is clicked, has the "repeat subfor for each data item" option greyed out. If I go one step higher on the hierarchy and go to the body page that contains this subform the options is available..I set it to to have a min of 1 and a max of 50....but the same error is still produced when I test it.



but now that you point it out...the example I've been comparing against has the subform level set to a min of 1 and no max defined. Do you think this is my issue? Any thoughts on why I'm greyed out?

Avatar

Former Community Member
I tackled the greyed out thing....apparently the parent page has to be utlize "flow content" in order for the min and max option to be avilable in any subforms.



Unfortunately it didn't seem to change anything, button doesn't work....and now debugger isn't giving any error messages. Not sure where to go now. My form is very basic just two text boxes in their own subform, and a button in its own subform..with the above code for the click action. This is driving me nuts:) I know I'm missing something really small. Any thoughts?

Avatar

Former Community Member
Tough to say what's wrong based on the description, but here's a working sample for you to compare with. Hopefully you'll see what's causing the problem.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member

Can You please send me the working sample for add instance I have the same problem.

Avatar

Former Community Member
Thanks a ton for the sample...unfortunately the problem was that I'm an idiot:) I was saving the document as a static pdf, not dynamic. Thanks for the help.