Commit f5cd82c6 authored by Frank Wall's avatar Frank Wall

fix validator for CertificateField

parent f7ceeb3e
......@@ -29,6 +29,7 @@
*/
namespace OPNsense\Base\FieldTypes;
use Phalcon\Validation\Validator\InclusionIn;
use OPNsense\Base\Validators\CsvListValidator;
use OPNsense\Core\Config;
......@@ -136,8 +137,15 @@ class CertificateField extends BaseField
{
$validators = parent::getValidators();
if ($this->internalValue != null) {
$validators[] = new CsvListValidator(array('message' => $this->internalValidationMessage,
'domain'=>array_keys(self::$internalOptionList)));
if ($this->internalMultiSelect) {
// field may contain more than one country
$validators[] = new CsvListValidator(array('message' => $this->internalValidationMessage,
'domain'=>array_keys(self::$internalOptionList)));
} else {
// single country selection
$validators[] = new InclusionIn(array('message' => $this->internalValidationMessage,
'domain'=>array_keys(self::$internalOptionList)));
}
}
return $validators;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment