<div id="poll" class="jsOnly tabMenuContent container containerPadding">
<fieldset>
- <dl{if $errorField == 'pollOptions'} class="formError"{/if}>
+ <dl{if $errorField == 'pollQuestion'} class="formError"{/if}>
<dt>
<label for="pollQuestion">{lang}wcf.poll.question{/lang}</label>
</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>
+ </dl>
+ <dl{if $errorField == 'pollOptions'} class="formError"{/if}>
<dt>
<label>{lang}wcf.poll.options{/lang}</label>
</dt>
* Validates poll parameters.
*/
public function validate() {
- // if no question is given, ignore poll completely
- if (empty($this->pollData['question'])) {
+ $count = count($this->pollOptions);
+
+ // if no question and no options are given, ignore poll completely
+ if (empty($this->pollData['question']) && !$count) {
return;
}
+
+ // no question given
+ if (empty($this->pollData['question'])) {
+ throw new UserInputException('pollQuestion');
+ }
if ($this->pollData['endTime'] && $this->pollData['endTime'] <= TIME_NOW) {
if ($this->poll === null || $this->poll->endTime >= TIME_NOW) {
}
// no options given
- $count = count($this->pollOptions);
if (!$count) {
throw new UserInputException('pollOptions');
}