public static $_MyValidationRuleXRegex = '/^[a-z\p{L} +\'\/\\&:,.\n\r-]*$/iu';
public static function _validation_my_rule_x($val)
{
return $val === '' || preg_match(static::$_MyValidationRuleXRegex, $val);
}
...
...
'MyFieldY' =>
array (
'data_type' => 'varchar',
'label' => 'Field Y Label',
'null' => true,
'validation' =>
array (
'required',
'max_length' => array(20), // etc.
'my_rule_x', // Apply the rule defined higher up in this model.
),
'form' => ...
),
...
Validation rule my_rule_x failed for Field Y Label
<?php
return array(
'my_rule_x' => '":label" contains invalid characters.'
. 'You may use letters, spaces and special characters /, \\, &, \', - and a full stop/period',
);
-- JJ It looks like you're new here. If you want to get involved, click one of these buttons!