heimrichhannot / contao-multi-column-editor-bundle

This module offers an input type for editing one or more records in frontend and backend.
GNU General Public License v3.0
6 stars 7 forks source link

Fehler im Frontend und Backend bei Einbindung in Contao 4.13 #28

Open franklytom opened 4 months ago

franklytom commented 4 months ago

Context Contao version: 4.13 Bundle version: 2.18 PHP version: 8.2

Description Getestet auf einer aktuellen Contao Installation mit der Beispielwebsite. tl_member wird erweitert um ein Feld children mit folgender Konfiguration.

`<?php

use Contao\CoreBundle\DataContainer\PaletteManipulator;

$GLOBALS['TL_DCA']['tl_member']['fields']['children'] = [ 'inputType' => 'multiColumnEditor', 'exclude' => true, 'eval' => [ 'multiColumnEditor' => [ 'sortable' => true, 'minRowCount' => 1, 'maxRowCount' => 8, 'isFrontend' => true, 'isBackend' => true, 'fields' => [ 'firstname' => [ 'label' => 'Vorname', 'inputType' => 'text', 'eval' => ['groupStyle' => 'width:150px', 'submitOnChange' => true] ], 'lastname' => [ 'label' => 'Nachname', 'inputType' => 'text', 'eval' => ['groupStyle' => 'width:150px'] ], 'birthdate' => [ 'label' => 'Geburtsdatum', 'inputType' => 'text', 'eval' => ['rgxp'=>'date', 'datepicker'=>true, 'mandatory'=>true, 'tl_class'=>'wizard'] ] ] ], 'feEditable'=>true, 'feViewable'=>true, 'feGroup'=>'children' ], 'sql' => "blob NULL" ];

PaletteManipulator::create() ->addLegend('children_legend', 'invisible_legend', PaletteManipulator::POSITION_AFTER) ->addField('children', 'children_legend', PaletteManipulator::POSITION_APPEND) ->applyToPalette('default', 'tl_member') ; `

Grundsätzlich funktioniert das Verhalten im Backend mit folgenden Auffälligkeiten:

Bildschirmfoto 2024-02-22 um 09 18 52

Das Frontend jedoch funktioniert nicht: Dazu erstelle ich ein Registrierungsmodul und wähle das Feld children aus.

Bildschirmfoto 2024-02-22 um 09 22 27

Im FE wird das Feld dann angezeigt, aber:

1) Ein JavaScript-Error weißt auf ein Problem mit Sortable hin: Uncaught (in promise) TypeError: t.create is not a function at contao-multi-column-editor-bundle.js?v=6f2e73b4:1:9505 at NodeList.forEach () at contao-multi-column-editor-bundle.js?v=6f2e73b4:1:9482

2) Klick auf Add produziert folgenden JS-Error: POST https://www-local.contao.de/?as=ajax&ag=_mce&aa=addRow 400 (Bad Request)

3) Klick auf Sort bleibt ohne Reaktion.

Was mache ich falsch? 👯

Bildschirmfoto 2024-02-22 um 09 25 25
koertho commented 4 months ago

Hallo, also der MultiColumnEditor funktioniert im Frontend bisher nur in Kombination mit Formhybrid (von dessen Einsatz wird aber abraten, da wir es selber einstellen wollen). Für Formgenerator oder das Registrierungs-Modul ist es aktuell nicht ausgelegt. Ein PR ist natürlich gern gesehen.

Was die Backend-Fehler anbelangt: die Labels müssen genau wie Contao-Feld-Labels angelegt werden, also Feldname und Beschreibung. Bei dir fehlt hier also eine Ebene. Das Icons rutscht vermutlich wegen dem Styling nach unten, da gibt es das groupStyle-Attribut in der DCA (siehe Beispiel in der Readme).