Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

moveInstance and insertInstance eats image

Avatar

Level 4

Hi,

I have a curious problem with repeating subforms.

My repeating subform looks something like this:

myRepeatingSubform

     someField

     aPositionedSubform

          myImage

          myRemoveButton (which is not filled)

Now when I say

_myRepeatingSubform.addInstance(true);

everything is fine. I get another line at the end and I get to see my image.

But when I say

_myRepeatingSubform.insertInstance(0);

or

_myRepeatingSubform.moveInstance(_myRepeatingSubform.count - 1, 0);

then the image disappears. The button is still there. But the image is not visible anymore.

Does anyone have an explanation for that?

Is it perhaps an error of some kind?

Uli

0 Replies

Avatar

Level 4

Update:

This forum's search function currently isn't working properly. I did find out that someone had a similar problem in 2008: "missing image in repeating subform"

I also checked out the images' presence with this line:

    for (var i = 0; i< _myRepeatingSubform.count; i++) {
        console.println(i + ": " + resolveNode("myRepeatingSubform[" + i + "].aPositionedSubform.myImage").presence);
        }

As expected I get "visible" for every instance of the image. (Which is of cource a lie, as obviously the image is NOT visible ....)

Appears like a bug in my eyes. Does anyone have a good workaround?

A someone quirky workaround that actually works is:

    for (var i = 0; i< _myRepeatingSubform.count; i++) {
         resolveNode("myRepeatingSubform[" + i + "].aPositionedSubform.myImage").presence = "visible";
         }

You can actually write

if (resolveNode("myRepeatingSubform[" + i + "].aPositionedSubform.myImage").presence == "visible")

     resolveNode("myRepeatingSubform[" + i + "].aPositionedSubform.myImage").presence = "visible";

This makes a difference!