madeyourday / contao-rocksolid-custom-elements

RockSolid Custom Elements Contao Extension
http://rocksolidthemes.com/de/contao/plugins/custom-content-elements
MIT License
48 stars 12 forks source link

dependsOn issues with list element #161

Closed aschempp closed 1 year ago

aschempp commented 1 year ago

I have a custom element with a list of links (maxItems = 2). The radio button triggers a dependsOn to switch between a text link field and a form select menu. Everything works fine, except for the case when clicking Neues Element. Then the first radio button also controls the second dependsOn, until I reload the page.

Bildschirmfoto 2023-06-23 um 09 13 51

Definition looks like this:

return [
    'label' => ['Links', 'Sie können bis zu zwei Links zum Element hinzufügen.'],
    'elementLabel' => '%s. Link',
    'inputType' => 'list',
    'maxItems' => 2,
    'fields' => [
        'type' => [
            'label' => ['Aktion', 'Wählen Sie den Aktions-Typ'],
            'default' => 'link',
            'inputType' => 'radio',
            'options' => ['link' => 'Link', 'form' => 'Formular'],
            'eval' => ['mandatory' => true, 'tl_class' => 'w33'],
        ],
        'form' => [
            'label' => ['Formular', 'Wählen Sie das Formular, welches im Popup angezeigt werden soll.'],
            'inputType' => 'select',
            'foreignKey' => 'tl_form.title',
            'eval' => ['mandatory' => true, 'includeBlankOption' => true, 'tl_class' => 'clr w50'],
            'dependsOn' => [
                'field' => 'type',
                'value' => 'form',
            ],
        ],
        'url' => [
            'label' => ['Link-Adresse', 'Geben Sie eine Web-Adresse (https://…), eine E-Mail-Adresse (mailto:…) oder ein Insert-Tag ein.'],
            'inputType' => 'text',
            'eval' => ['mandatory' => true, 'rgxp' => 'url', 'dcaPicker' => true, 'tl_class' => 'clr w50'],
            'dependsOn' => [
                'field' => 'type',
                'value' => 'link',
            ],
        ],
        'linkTitle' => [
            'label' => ['Link-Titel', 'Geben Sie den Titel für den Aktions-Button ein.'],
            'inputType' => 'text',
            'eval' => ['mandatory' => true, 'tl_class' => 'w50'],
        ],
    ],
];
ausi commented 1 year ago

Should be fixed with d1e9be46ddae9f4fa069a78699b4258268324b8b

@aschempp can you verify that your issue disappears if you update to dev-master?

ausi commented 1 year ago

Released as version 2.4.5