diff --git a/inc/form.class.php b/inc/form.class.php index 78790a1ac..758c9bea9 100644 --- a/inc/form.class.php +++ b/inc/form.class.php @@ -1248,19 +1248,17 @@ class='formcreator_form form_horizontal'>"; break; } - switch (count($result)) { - case 1: - reset($validators); - $validatorId = key($validators); - echo Html::hidden('formcreator_validator', ['value' => $validatorId]); - break; - case 2: - $validators = [0 => Dropdown::EMPTY_VALUE] + $validators; - echo '

' . __('Validation', 'formcreator') . '

'; - echo '
'; - echo ''; - Dropdown::showFromArray('formcreator_validator', $validators); - break; + $resultCount = count($result); + if ($resultCount == 1) { + reset($validators); + $validatorId = key($validators); + echo Html::hidden('formcreator_validator', ['value' => $validatorId]); + } else if ($resultCount > 1) { + $validators = [0 => Dropdown::EMPTY_VALUE] + $validators; + echo '

' . __('Validation', 'formcreator') . '

'; + echo '
'; + echo ''; + Dropdown::showFromArray('formcreator_validator', $validators); } }