From: Marcel Werk Date: Wed, 11 Mar 2020 11:52:46 +0000 (+0100) Subject: Fixed multiple form field validation issues in the language item add form X-Git-Tag: 5.2.4~23 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=594d0981f94dc9f9e02191842c91ec0c5cd4079d;p=GitHub%2FWoltLab%2FWCF.git Fixed multiple form field validation issues in the language item add form --- diff --git a/wcfsetup/install/files/lib/acp/form/LanguageItemAddForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageItemAddForm.class.php index 1c27e45483..54cc0ff2f7 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageItemAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageItemAddForm.class.php @@ -78,6 +78,7 @@ class LanguageItemAddForm extends AbstractFormBuilderForm { return $list; }, false, false) + ->required() ->filterable(), TextFormField::create('languageItem') @@ -127,15 +128,15 @@ class LanguageItemAddForm extends AbstractFormBuilderForm { /** @var SingleSelectionFormField $languageCategoryID */ $languageCategoryID = $formField->getDocument()->getNodeById('languageCategoryID'); - $languageCategory = LanguageFactory::getInstance()->getCategoryByID($languageCategoryID->getSaveValue()); - - if (strpos($formField->getSaveValue(), $languageCategory->languageCategory) . '.' !== 0) { - $formField->addValidationError( - new FormFieldValidationError( - 'prefixMismatch', - 'wcf.acp.language.item.languageItem.error.prefixMismatch' - ) - ); + if ($languageCategory = LanguageFactory::getInstance()->getCategoryByID($languageCategoryID->getSaveValue())) { + if (strpos($formField->getSaveValue(), $languageCategory->languageCategory . '.') !== 0) { + $formField->addValidationError( + new FormFieldValidationError( + 'prefixMismatch', + 'wcf.acp.language.item.languageItem.error.prefixMismatch' + ) + ); + } } break;