[BUGFIX] Mandatory for Selectbox with TCA not possible 25/28625/2
authorBenjamin Mack <benni@typo3.org>
Thu, 30 Jan 2014 20:30:53 +0000 (21:30 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 15 Apr 2014 15:50:04 +0000 (17:50 +0200)
It's not possible to create a backend selectbox
that is mandatory with only 1 item selectable.

Releases: 6.2, 6.1
Resolves: #24925
Resolves: #24871
Change-Id: Idaef6475f61c70cd8c3f6074ccd0b0195d90c581
Reviewed-on: https://review.typo3.org/28625
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/backend/Classes/Form/FormEngine.php

index 1c643d4..59c3716 100644 (file)
@@ -1808,6 +1808,11 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                        $disabled = ' disabled="disabled"';
                        $onlySelectedIconShown = 1;
                }
+               // Register as required if minitems is greater than zero
+               if (($minItems = MathUtility::forceIntegerInRange($config['minitems'], 0)) > 0) {
+                       $this->registerRequiredProperty('field', $table . '_' . $row['uid'] . '_' . $field, $PA['itemFormElName']);
+               }
+
                // Icon configuration:
                if ($config['suppress_icons'] == 'IF_VALUE_FALSE') {
                        $suppressIcons = !$PA['itemFormElValue'] ? 1 : 0;