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

Fill in colour for repeating subforms

Avatar

Level 7

I have a repeating subform with max count 5 subforms.

Is it possible the 4th and 5th repeating rows to have another fill colour?

Here is the script I use for the Add Instance button:

 

_Item.addInstance();

Thank you

Here is the script I use for the remove Instance button:

if

(_Item.count > 1)

_Item.removeInstance(this.parent.index);

Item is a row in a table.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

First off, I would not be inclined to name an object/subform "Item". It is very close to a reserved word "item".

Also in the addInstance() method, you should pass a parameter. The default is true.

One route would be to use the layout:ready event of the repeating subform. This is not very efficient, as the layout:ready event fires so often as the user interacts with the form. However it will deal with situations where rows are added and removed.

if (this.parent.index >= 3) {

     this.fillColor = "255,129,129";

}

This might give you a start,

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

First off, I would not be inclined to name an object/subform "Item". It is very close to a reserved word "item".

Also in the addInstance() method, you should pass a parameter. The default is true.

One route would be to use the layout:ready event of the repeating subform. This is not very efficient, as the layout:ready event fires so often as the user interacts with the form. However it will deal with situations where rows are added and removed.

if (this.parent.index >= 3) {

     this.fillColor = "255,129,129";

}

This might give you a start,

Niall