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

Adding subform using Instance Manager

Avatar

Level 5

Good Day;

I am developing a form and one of the things I am trying to do is get a full subform to repeat if the user has to add more items.

The subform has 1 table and 1 row. If the user selects from a status dropdown  anything but “green”  a text box becomes visible and the user must add details.

I have placed a button on a separate subform if the user wants to (needs to) add 2 or more projects.

I tried using the following and I get the standard “general” error.

psl_list_subform.instanceManager.addInstance(1);

Am I going about this correctly or am I way out in left field.

Thanks all

Chomp

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Is the Reapeat Row set for Psl_list_subform? Do you have a max value set for that subform? If you are still having issues can you email the form to LiveCycle8@gmail.com and I will have a look.

paul

View solution in original post

4 Replies

Avatar

Former Community Member

Is there an instance of psl_list_subform available on the form when you execute this command? If not then that is your issue ...To be able to address an object it has to exist.....if it does not then you must use the undersore technique to call the instanceManager. This basically says that although the subform does not exist (it is not part of the layout subform) it does exist in the template dom so it needs to be addressed in a different way. So your expression woudl be _psl_list_subform.addInstance(1).

Paul

Avatar

Level 5

Thanks Paul.

It did not seem to work.

I have tried both ways _psl_list_subform.addInstance(1). And

Psl_list_subform.instanceManager.addInstance(1);

And I am getting the same error.

GeneralError: Operation failed.

  1. XFAObject.addInstance:1:XFA:form1[0]:#subform[0]:psl_list_subform[0]:Table5[0]:Row1[0]:Button[0]:click

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

I have Repeat row for each data item checked off. This field is grayed out for the psl_list_subform.

Within the subform I have 1 table with 1 row, a text box . When the user clicks the “add” button I would like the table to repeat along with the textbox below it.

Using the codes above I have tried with the add button inside the psl_list_subform as well as placing the add button outside the psl_list_subform. I still get the same error.

I have a feeling I am either missing something basic or I am going about this all wrong

Thanks again Paul

Avatar

Correct answer by
Former Community Member

Is the Reapeat Row set for Psl_list_subform? Do you have a max value set for that subform? If you are still having issues can you email the form to LiveCycle8@gmail.com and I will have a look.

paul

Avatar

Level 5

Thanks Paul

Sorry for taking so long to get back to you. It appears the "powers that be" want to think about this approach a wee bit... Once they (the powers that be) have determined what they want, I may be asking more questions.

For now I am going to make this question as answered.

Thanks again Paul

Chomp

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----