Handle poll question validation errors for quick replies
authorMatthias Schmidt <gravatronics@live.com>
Thu, 10 Jun 2021 06:56:53 +0000 (08:56 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 10 Jun 2021 06:56:53 +0000 (08:56 +0200)
wcfsetup/install/files/js/WCF.Poll.js

index 68d0207d1d935b7c9a369d848f4c1e0193f3617a..290423d6eae1a199106274a793129b798f4bd389 100644 (file)
@@ -312,6 +312,18 @@ if (COMPILER_TARGET_DEFAULT) {
                
                _handleError: function (data) {
                        switch (data.returnValues.fieldName) {
+                               case 'pollQuestion':
+                                       var questionField = elById('pollQuestion_' + this._editorId);
+                                       var errorMessage = WCF.Language.get('wcf.global.form.error.empty');
+                                       if (data.returnValues.errorType !== 'empty') {
+                                               errorMessage = WCF.Language.get('wcf.poll.pollQuestion.error.' + data.returnValues.errorType);
+                                       }
+                                       
+                                       elInnerError(questionField, errorMessage);
+                                       
+                                       data.cancel = true;
+                                       break;
+                                       
                                case 'pollEndTime':
                                case 'pollMaxVotes':
                                        var fieldName = (data.returnValues.fieldName === 'pollEndTime') ? 'endTime' : 'maxVotes';