Feature #28399

Validation message and code should be configurable for bundled validators

Added by Christopher Hlubek over 10 years ago. Updated almost 9 years ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Validation
Target version:
-
Start date:
2011-07-22
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

For custom applications the bundled validators of FLOW3 are nice but unusable if different messages and codes have to be used (e.g. for a custom Regex Validator).

It would be more flexible to have two options code and message per Validator (or multiple if more than one message is added) that can be configured by the user. Additionaly a message type ("error" or "warning") would be nice.

The code change is pretty straight forward and should be compatible to the current version:

protected function isValid($value) {
  ...
  // If invalid
  $message = isset($this->options['message']) ? $this->options['message'] : 'Default error message';
  $code = isset($this->options['code']) ? $this->options['code'] : 12345678;
  $this->addError($message, $code);
}

Related issues

Related to TYPO3.Flow - Feature #6456: Customization/localization of validator errorsClosed

Actions
Related to TYPO3.Flow - Feature #33970: Add translation files for bundled validator error messagesResolvedKarsten Dambekalns2012-02-16

Actions
Related to TYPO3.Flow - Feature #43841: Add package support to validation errorsNew2012-12-10

Actions

Also available in: Atom PDF