Ad

Disable Field In TCA When Editing A Record

- 1 answer

Is it possible to disable a field in the TCA config, only when editing a record?

TCA config for new record:

'title' => [
    'exclude' => true,
    'label' => 'Title',
    'config' => [
        'type' => 'input',
        'size' => 30,
        'eval' => 'trim,required'
    ],
],

TCA config for existing records:

'title' => [
    'exclude' => true,
    'label' => 'Title',
    'config' => [
        'type' => 'input',
        'size' => 30,
        'eval' => 'trim,required'
        'readOnly' => true,
    ],
],
Ad

Answer

I'm not aware of a built in solution for different TCA settings for new and existing records.

Since the final TCA is cached there is also no way to manipulate it with some PHP on runtime.

Ad
source: stackoverflow.com
Ad