* Overhauled Redactor integration
* Linebreaks mode instead of using paragraphs, works better with the PHP-side parser which works with linebreaks
* Ported the PHP-BBCode parser, massively improves accuracy and ensures validity
+* Show error message if poll options are given but not question instead of discarding poll options.
</dt>
<dd>
<input type="text" name="pollQuestion" id="pollQuestion" value="{$pollQuestion}" class="long" maxlength="255" />
+ {if $errorField == 'pollQuestion'}
+ <small class="innerError">
+ {lang}wcf.global.form.error.empty{/lang}
+ </small>
+ {/if}
</dd>
<dt>
<label>{lang}wcf.poll.options{/lang}</label>
* Validates poll parameters.
*/
public function validate() {
- // if no question is given, ignore poll completely
- if (empty($this->pollData['question'])) {
- return;
- }
-
if ($this->pollData['endTime'] && $this->pollData['endTime'] <= TIME_NOW) {
if ($this->poll === null || $this->poll->endTime >= TIME_NOW) {
// end time is in the past
}
}
- // no options given
$count = count($this->pollOptions);
- if (!$count) {
+ if (empty($this->pollData['question'])) {
+ if ($count) {
+ // options given, but no question
+ throw new UserInputException('pollQuestion');
+ }
+ else {
+ // if no question and no options are given, ignore poll completely
+ return;
+ }
+ }
+ else if (!$count) {
+ // no options given
throw new UserInputException('pollOptions');
}