Search code examples
typo3typoscripttypo3-extensions

TYPO3 formhandler using multiple validators


Our customer uses a TYPO3 6.2.14 and built a formular with formhandler(2.0.1). Now we have to add a captcha to prevent spambots to post. So I installed captcha(1.3.0) as recommended in the documentation and added the following lines of typoscript (validation part only):

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
        }
      }
    }

  }

  # ...

}

The required fields still works like before and also the captcha field reacts to a non-filled state and abbort the submission if the captcha is wrong. But why it doesn't show up an error like "Your entered captcha doesn't match"?


Solution

  • I just need to add the captchafield.errorCheck.1 = captcha to the default validator. The reason for the empty error messages was the not cleared install tool cache. The language xml Files containing some outputs are cached by default.