This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

voidshah
voidshah

fields.yaml


fields:
    testcol:
        type: repeater
        form:
            fields:
                title:
                    label: ITEM
                item:
                    type: repeater
                    prompt: Add new subitem
                    form:
                        fields:
                            subtitle:
                                span: left
                                label: subitem

I create item with two subitems:

When if I add a new item, I get the following picture:

But I expected get the following:

Is it normal behavior or bug?!

Last updated

alxy
alxy

Nested repeaters are not supported ;) I have also already made that experience.

voidshah
voidshah

But the data saved in database properly. I should only delete excess subitems manually. Bug occurs only when I create a new ITEM.

Last updated

voidshah
voidshah

I think I found the solution!))) Adding this code into root\modules\backend\formwidgets\Repeater.php will solve the problem


 protected function processExistingItems()
    {
        $loadValue = $this->getLoadValue();
        if (is_array($loadValue)) {
            $loadValue = array_keys($loadValue);
        }
        $itemIndexes = post(self::INDEX_PREFIX.$this->formField->getName(false), $loadValue);

------> if (!$loadValue) return;

        if (!is_array($itemIndexes)) return;
        foreach ($itemIndexes as $itemIndex) {
            $this->makeItemFormWidget($itemIndex);
            $this->indexCount = max((int) $itemIndex, $this->indexCount);
        }
    }

Last updated

voidshah
voidshah

I spent a deeper testing and discovered that my solution is wrong. (((

beaudinngreve10852
beaudinngreve10852

it seems that Nested repeaters are now supported

ranmichael
ranmichael

beaudinngreve10852 said:

it seems that Nested repeaters are now supported

hmmmm... They don't seem to work on Static Pages. Has anyone figured this out?

info17589
info17589

hmmmm... They don't seem to work on Static Pages. Has anyone figured this out?

I have the same problem... anybody with an idea how to solve this?

platforms67915
platforms67915

info17589 said:

hmmmm... They don't seem to work on Static Pages. Has anyone figured this out?

I have the same problem... anybody with an idea how to solve this?

1-9 of 9

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.