From 594d0981f94dc9f9e02191842c91ec0c5cd4079d Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 11 Mar 2020 12:52:46 +0100 Subject: [PATCH] Fixed multiple form field validation issues in the language item add form --- .../acp/form/LanguageItemAddForm.class.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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; -- 2.20.1