$innerError = $('<small class="innerError" />').appendTo(this._textarea.parent());
}
- $innerError.html((data.returnValues.errorType === 'empty' ? WCF.Language.get('wcf.global.form.error.empty') : data.returnValues.errorMessage));
+ var message = (data.returnValues.errorType === 'empty' ? WCF.Language.get('wcf.global.form.error.empty') : data.returnValues.errorMessage);
+ if (data.returnValues.realErrorMessage) message = data.returnValues.realErrorMessage;
+ $innerError.html(message);
return false;
}
this._restoreEditor();
//noinspection JSUnresolvedVariable
- if (!data || data.returnValues === undefined || data.returnValues.errorType === undefined) {
+ if (!data || data.returnValues === undefined || data.returnValues.realErrorMessage === undefined) {
return true;
}
}
//noinspection JSUnresolvedVariable
- innerError.textContent = data.returnValues.errorType;
+ innerError.textContent = data.returnValues.realErrorMessage;
return false;
},
*/
_handleError: function(data) {
//noinspection JSUnresolvedVariable
- this.throwError(this._textarea, data.returnValues.errorType);
+ this.throwError(this._textarea, data.returnValues.realErrorMessage);
},
/**
this._hideLoadingOverlay();
//noinspection JSUnresolvedVariable
- if (data === null || data.returnValues === undefined || data.returnValues.errorType === undefined) {
+ if (data === null || data.returnValues === undefined || data.returnValues.realErrorMessage === undefined) {
return true;
}
public function __construct($fieldName, $errorMessage = 'empty', array $variables = []) {
$this->errorMessage = $errorMessage;
if (mb_strpos($this->errorMessage, '.') === false) {
- $this->errorMessage = WCF::getLanguage()->get('wcf.global.form.error.'.$this->errorMessage);
+ if (preg_match('~^([a-zA-Z0-9-_]+\.)+[a-zA-Z0-9-_]+$~', $this->errorMessage)) {
+ $this->errorMessage = WCF::getLanguage()->get('wcf.global.form.error.'.$this->errorMessage);
+ }
}
else {
$this->errorMessage = WCF::getLanguage()->getDynamicVariable($this->errorMessage, $variables);