Open Journal Systems  3.3.0
FormValidatorInSet.inc.php
1 <?php
2 
16 import('lib.pkp.classes.form.validation.FormValidator');
17 
19 
21  var $_acceptedValues;
22 
31  function __construct(&$form, $field, $type, $message, $acceptedValues) {
32  parent::__construct($form, $field, $type, $message);
33  $this->_acceptedValues = $acceptedValues;
34  }
35 
36 
37  //
38  // Public methods
39  //
45  function isValid() {
46  return $this->isEmptyAndOptional() || in_array($this->getFieldValue(), $this->_acceptedValues);
47  }
48 }
49 
50 
FormValidatorInSet\__construct
__construct(&$form, $field, $type, $message, $acceptedValues)
Definition: FormValidatorInSet.inc.php:34
FormValidatorInSet\isValid
isValid()
Definition: FormValidatorInSet.inc.php:48
FormValidatorInSet\$_acceptedValues
$_acceptedValues
Definition: FormValidatorInSet.inc.php:24
FormValidator
Class to represent a form validation check.
Definition: FormValidator.inc.php:23
FormValidatorInSet
Form validation check that checks if value is within a certain set.
Definition: FormValidatorInSet.inc.php:18
FormValidator\isEmptyAndOptional
isEmptyAndOptional()
Definition: FormValidator.inc.php:165
FormValidator\getFieldValue
getFieldValue()
Definition: FormValidator.inc.php:154