contao-community-alliance / contao-multicolumnwizard-bundle

Contao 4 Widget - MultiColumnWizard
GNU Lesser General Public License v3.0
12 stars 12 forks source link

add eval readonly #81

Open zonky2 opened 4 years ago

zonky2 commented 4 years ago

it´s possible to add attribute readonly?

e.g. for MetaModels/attribute_tabletext#7

see https://github.com/menatwork/MultiColumnWizard/issues/214

Total-Reality commented 3 years ago

It already works in Contao 4.9, MCW 3.4.9

zonky2 commented 3 years ago

for all widgets?

Total-Reality commented 3 years ago

The question is which fields support this feature in Contao itself? This is not clear @Documentation https://docs.contao.org/dev/reference/dca/fields/#reference

I tested it with several field types. It works with text, textarea, inputUnit and textStore.

It does not work with select, checkbox, imageSize, checkboxWizard, radio, pageTree, fileTree. But I think this also does not work in Contao standard fields.

zonky2 commented 3 years ago

Ahh! I thought about it again - I didn't mean readonly for the individual widgets, but readonly for the MCW. This of course includes that the individual widgets can be set readonly....

Total-Reality commented 3 years ago

Okay, I tested it. It works. You can add new lines, but these won't be saved. This is the same procedure in several other Contao fields like inputType => list et cetera.

This is no bug imo.

zonky2 commented 3 years ago

post your config...

Total-Reality commented 3 years ago

Btw. changes in existing lines won't be saved also.

$GLOBALS['TL_DCA'][$strTblName]['fields']['mcwtest222'] = array
(
    'exclude'   => true,
    'inputType' => 'multiColumnWizard',
    'eval'      => array
    (
        //'columnsCallback' => array('tl_mcw_test', 'getTestFields'),
    'readonly' => true,
        'columnFields' => array
        (
          'text' => array
          (
            'label'              => 'text',
            'default'            => 'Bla',
            'inputType'          => 'text',
            'eval'               => array('maxlength'=>5, 'style'=>'width:50px') //, 'nospace'=>true, 'trailingSlash'=>true
          )
      ),
    ),
    'sql'       => "blob NULL"
);