Fix validating label group name
authorMatthias Schmidt <gravatronics@live.com>
Thu, 16 Apr 2015 16:03:45 +0000 (18:03 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 16 Apr 2015 16:03:45 +0000 (18:03 +0200)
wcfsetup/install/files/acp/templates/labelGroupAdd.tpl
wcfsetup/install/files/lib/acp/form/LabelGroupAddForm.class.php

index 53e1a0e1460253279c0b53755c8f61f07235c2ae..1b261b8d69b539dad5041c58b89eaa98fd89d24c 100644 (file)
@@ -59,8 +59,8 @@
                                                <input type="text" id="groupName" name="groupName" value="{$i18nPlainValues['groupName']}" autofocus="autofocus" class="long" />
                                                {if $errorField == 'groupName'}
                                                        <small class="innerError">
-                                                               {if $errorType == 'empty'}
-                                                                       {lang}wcf.global.form.error.empty{/lang}
+                                                               {if $errorType == 'empty' || $errorType == 'multilingual'}
+                                                                       {lang}wcf.global.form.error.{@$errorType}{/lang}
                                                                {else}
                                                                        {lang}wcf.acp.label.group.groupName.error.{@$errorType}{/lang}
                                                                {/if}
index 6cdbd91c680c45a63dc983aaf6b6f2fffa893a1c..76e012f3ace3273058fba2368be9b42d0087a7ef 100644 (file)
@@ -134,18 +134,13 @@ class LabelGroupAddForm extends AbstractForm {
                parent::validate();
                
                // validate group name
-               try {
-                       if (!I18nHandler::getInstance()->validateValue('groupName')) {
-                               if (I18nHandler::getInstance()->isPlainValue('groupName')) {
-                                       throw new UserInputException('groupName');
-                               }
-                               else {
-                                       throw new UserInputException('groupName', 'multilingual');
-                               }
+               if (!I18nHandler::getInstance()->validateValue('groupName')) {
+                       if (I18nHandler::getInstance()->isPlainValue('groupName')) {
+                               throw new UserInputException('groupName');
+                       }
+                       else {
+                               throw new UserInputException('groupName', 'multilingual');
                        }
-               }
-               catch (UserInputException $e) {
-                       $this->errorType[$e->getField()] = $e->getType();
                }
                
                // validate object type relations