Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Instance Manager Not Repeating Subform

Avatar

Former Community Member

Hello,

I have a form which I am trying to repeat a subform in.  The code sits on a drop down menu, and is in javascript:

if (this.rawValue == 0)
{
form1.Page2.sfPhone.instanceManager.setInstances(1);
form1.Page2.sfPhone.presence ="hidden";
}
else
{
form1.Page2.sfPhone.presence="visible";
form1.Page2.sfPhone.instanceManager.setInstances(this.rawValue);
}

I get no errors at run time, it just doesn't repeat the form.  I have attached it.  Does anyone have any ideas?

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Not exactly sure what the form is supposed to look like but the root subform that holds the repeating subform must be set to flowed and not positioned. I modified it in my sample and have attached it. Also on the subform tab you can now control what initial settings you want and the min and max number of subforms that will be allowed. Note that if you set the initial count to 0, your script will fail becuase you will be addressing an object that does not exist. If you want to do this you can use a shortcut to the instance manager that does exist. Change your code to look like this:

form1.Page2._sfPhone.setInstances(1);

The underscore before the subform name indicates that you are addressing the instance manager (even if the object does not exist yet - i.e. it has 0 instances).

Paul

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

Not exactly sure what the form is supposed to look like but the root subform that holds the repeating subform must be set to flowed and not positioned. I modified it in my sample and have attached it. Also on the subform tab you can now control what initial settings you want and the min and max number of subforms that will be allowed. Note that if you set the initial count to 0, your script will fail becuase you will be addressing an object that does not exist. If you want to do this you can use a shortcut to the instance manager that does exist. Change your code to look like this:

form1.Page2._sfPhone.setInstances(1);

The underscore before the subform name indicates that you are addressing the instance manager (even if the object does not exist yet - i.e. it has 0 instances).

Paul

Avatar

Level 10

I have modified your PDF. Please see the attached file.

Is this what you are trying to do??

Nith

Avatar

Former Community Member

Thanks.  Somehow I missed the flowed setting on the main form.  That's what did it.

I'm curious to understand a little bit more about the instances though.  My code doesn't work exactly like I want it too.  I would like to start with initial count = 0 but I couldn't get that to work correctly.  I tried changing the code to:

if (this.rawValue == 0)
{
form1.Page2._sfPhone.instanceManager.setInstances(1);
form1.Page2.sfPhone.presence ="hidden";
}
else
{
form1.Page2.sfPhone.presence="visible";
form1.Page2._sfPhone.instanceManager.setInstances(1);
form1.Page2.sfPhone.instanceManager.setInstances(this.rawValue);
}

But this didn't work for me either.

Thanks

Joe

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] ----