rainlab/builder-plugin

Repeater maxItems

jjezik82 opened this issue · 2 comments

Hello, I am trying to create a repeater with pre-defined fields where should be exact number of items in repeater. Default fields are shown perfectly in creating new record. The problem is, that maxItems setting is in this case ignored (also minItems). I can add more items if I want. Is there problem with my repeater settings? Thanks.

in my fields.yaml

fields:
    progress: 
        label: Time line
        prompt: Add
        maxItems: '6'
        displayMode: default
        span: full
        type: repeater
        tab: 'Time line'
        form:
            fields:
                title:
                    label: title
                    span: auto
                    type: text
                body:
                    label: Text
                    size: tiny
                    span: auto
                    type: textarea
                is_active:
                    label: 'Active'
                    span: auto
                    type: switch
        default:
            0:
                title: 'Contract signed'
            1:
                title: 'Begining of construction'
            2:
                title: 'Foundations finished'
            3:
                title: 'First floor finished'
            4:
                title: 'Building finished'
            5:
                title: 'Final touches'

Hi @jjezik82!

Try removing this line

displayMode: default

We may need to include some sanitsation of this field, since it supports only two values: accordion or builder. Setting to default produces an unfinished display mode.

Hi @jjezik82!

Try removing this line

displayMode: default

We may need to include some sanitsation of this field, since it supports only two values: accordion or builder. Setting to default produces an unfinished display mode.

This worked perfectly! Thanks.