1. webvariants
  2. Untitled project
  3. Form Evaluation

Commits

Martin Schnabel  committed d51d57b

strict compare option for choice validator

  • Participants
  • Parent commits be53c3b
  • Branches default

Comments (0)

Files changed (1)

File lib/WV30/Validator/Choice.php

View file
  • Ignore whitespace
 	const PARAM_CALLBACK        = 'callback';
 	const PARAM_CALLBACK_PARAMS = 'callback_params';
 	const PARAM_ALLOW_EMPTY     = 'allow_empty';
-	const PARAM_KEYS             = 'keys';
+	const PARAM_KEYS            = 'keys';
+	const PARAM_STRICT_COMPARE  = 'strict_compare';
 
 	const ERROR_INVALID = 'invalid';
 
 		$parent = parent::isValid($value);
 		if ($parent !== true) return $parent;
 
-		if (!in_array($value, $this->getChoices(), true)) {
+		if (!in_array($value, $this->getChoices(), $this->getParam(self::PARAM_STRICT_COMPARE, true))) {
 			return $this->setErrorType(self::ERROR_INVALID);
 		}