使用多个验证器的 TYPO3 表单处理程序

TYPO3 formhandler using multiple validators

我们的客户使用 TYPO3 6.2.14 并使用 formhandler(2.0.1) 构建了一个公式。现在我们必须添加一个验证码来防止垃圾邮件到 post。所以我按照文档中的建议安装了 captcha(1.3.0) 并添加了以下错别字行(仅验证部分):

plugin.Tx_Formhandler.settings.predef.contact_test {

  # ...

  validators{

    # default validator
    1 {
      class = Validator_Default
      config {
        disableErrorCheckFields = captchafield
        fieldConf {
          salutation.errorCheck.1 = required
          firstname.errorCheck.1 = required
          lastname.errorCheck.1 = required

          email.errorCheck.1 = required
          email.errorCheck.2 = email

          subject.errorCheck.1 = required
          message.errorCheck.1 = required
        }
      }
    }

    # captcha validate 
    2 {
      class = Tx_Formhandler_Validator_Default
      config {
        disableErrorCheckFields = salutation,firstname,lastname,email,subject,message
        fieldConf {
          captchafield.errorCheck.1 = captcha
        }
      }
    }

  }

  # ...

}

必填字段仍然像以前一样工作,验证码字段也会对未填写状态做出反应,如果验证码错误则中止提交。但是为什么没有出现"Your entered captcha doesn't match"?

这样的错误

我只需要将 captchafield.errorCheck.1 = captcha 添加到默认验证器。出现空错误消息的原因是未清除安装工具缓存。语言 xml 默认缓存包含一些输出的文件。