Project

General

Profile

Actions

Feature #60908

open

Provide Evaluation of TCA select fields

Added by Moritz Ahl over 10 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2014-08-12
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Currently, it is not possible to require a (single) select field as mandatory, meaning non-empty or required in TCA. An "eval" property simply does not exist and is ignored if given.

Example:

'owner' => array(
        'exclude' => 1,
        'exclude' => 0,
        'label' => 'Owner',
        'config' => array(
                        'type' => 'select',
                        'foreign_table' => 'tx_myext_domain_model_owner',
                        'size' => 1,
                        'autoSizeMax' => 30,
                        'items' => array(
                                array('', ''),
                        ),
                    'maxitems' => 1,
                        'minitems' => 1,
                        'multiple' => 0,
                        'eval' => 'required,notEmpty'
        ),
),

That is really lame :-) A CMS must provide at least basic evaluation options for all input types.


Files

tcademo.zip (6.31 KB) tcademo.zip Gernot Ploiner, 2022-11-27 07:27

Related issues 3 (1 open2 closed)

Related to TYPO3 Core - Bug #60247: eval=>"required" not working with select fieldsClosed2014-07-10

Actions
Related to TYPO3 Core - Bug #94050: Do not reload form on change if mandatory fields are not filled inNew2021-05-04

Actions
Related to TYPO3 Core - Bug #99153: Discrepancy between behaviour and documentation for "eval" property in "select" fields in TCAClosed2022-11-21

Actions
Actions #1

Updated by Benjamin Rau over 10 years ago

I agree, you can only work around this actually by forcing the select to multiselect (size>1).
Beeing able to make a single select with empty default option mandatory is a must have for me, too.

Actions #2

Updated by Anonymous over 10 years ago

+1
I think this feature should be a must have for TYPO3.

Actions #3

Updated by Martin Sonnenholzer over 10 years ago

+1 I had that problem a few times

Actions #4

Updated by Felix Kopp almost 10 years ago

  • Tracker changed from Bug to Feature
  • Category changed from Backend API to FormEngine aka TCEforms
Actions #5

Updated by Krzysztof Napora over 7 years ago

‘minitems’ => 1,
‘maxitems’ => 1,
‘eval’ => ‘required’,

Actions #6

Updated by Gernot Ploiner about 2 years ago

What you are looking for is:

...
'items' => array(
        array('Please choose', 0),
),
'eval' => 'required'
...

This works, but it shouldn't. Because eval is not a setting for type=select.
See: https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/selectSingle.html

And there is a Bug combined with 'onChange' => 'reload'. See: https://forge.typo3.org/issues/94050

But this is a needed missing feature. Without, it is not possible to make a selectSingle with a "please choose" entry, which is required.
The Setting 'minitems=1' without "please choose" will work, but then you have one of the otions preselected. You cannot force the Editor to select an option.

The workaround with 'multiselect>1' is not beautiful.

Tested in TYPO3 10.4.

Actions #7

Updated by Sybille Peters about 2 years ago

  • Related to Bug #94050: Do not reload form on change if mandatory fields are not filled in added
Actions #8

Updated by Sybille Peters about 2 years ago

  • Related to Bug #99153: Discrepancy between behaviour and documentation for "eval" property in "select" fields in TCA added
Actions #9

Updated by Gernot Ploiner almost 2 years ago

I attached a small extension for TYPO3 11.5 (there is the same behavior as in 10.4) to easyly reproduce the two related problems:

Installation:
Install the extension: ddev composer require webprofil/tcademo:@dev
In the TYPO3 Backend:
  • create a regular page (e.g. uid=1)
  • create a folder in the pagetree (e.g. uid=2)
  • create a fegroup at the folder
  • create some feusers at the folder
  • create a 'Dummy' record at your page or folder

Now you can see the problems:

  1. Before you save, change the select "Type" to "Type 1". Then reload (click "yes"). This errormessage apperars, because "Employee" is not filled out:
    "2: SQL error: 'Incorrect integer value: '' for column `db`.`tx_tcademo_domain_model_dummy`.`employee` at row 1' (tx_tcademo_domain_model_dummy:NEW63830ddb4a18d611387331)"
  2. The "Employee" select is displayed as I expect. But as I know, the TCA-property 'eval' => 'required' is not allowed (and not documented) at TCA select / selectSingle. Without eval, it is not possible to make a selectSingle required with a "pleasechoose" option.
Actions

Also available in: Atom PDF