This project is no longer maintained and no further public releases are planned.

No further support will be given.

Feel free to fork the git repository.

How to set up error checks

Add markers like ###error_[fieldname]### to your template and set up validation in TypoScript:

plugin.Tx_Formhandler.settings.validators.1 {
  class = Validator\DefaultValidator
  config {
    fieldConf {
      field1 {
        errorCheck.1 = required
        errorCheck.2 = maxLength
        errorCheck.2.value = 50
      }
      field2 {
        errorCheck.1 = required
        errorCheck.2 = email
      }
    }
  }
}

Add entries for error messages to your translation file

<label index="error_field1_required">Field1 is required!</label>
<label index="error_field1_maxLength">Field1 has to be shorter than ###value### characters!</label>
<label index="error_field2_required">Field2 is required!</label>
<label index="error_field2_email">Field2 is no valid e-mail!</label>

NOTE: The marker ###value### in the error message is filled with the value of the parameter “value” for error check “maxLength”. If an error check requires parameters, you can use markers like ###[parametername]### in the translatable message.

When you have to validate values in nested arrays you can nest the validators as well. Given the following fields:

<input type="text" name="birthdate[day]"/>
<input type="text" name="birthdate[month]"/>
<input type="text" name="birthdate[year]"/>
<input type="text" name="name"/>

You can setup your validators like that:

validators.1.config.fieldConf {
  birthdate {
    day.errorCheck {
      1 = betweenValue
      1.minValue = 1
      1.maxValue = 31
    }
    month.errorCheck {
      1 = betweenValue
      1.minValue = 1
      1.maxValue = 12
    }
    year.errorCheck {
      1 = minValue
      1.minValue = 45
    }
  }
  birthdate.errorCheck.1 = maxItems
  birthdate.errorCheck.1.value = 3
  name.errorCheck.1 = required
}

The errors for the birthdate array will then be merged into the marker ###error_birthdate###.


to top