Reputation: 2150
How can I extend the following zend validator to include numbers with commas and points separator. Eg: 1.234.567,89
return array(
"*" => array("allowEmpty" => true),
"pret" => array(
"digits",
"presence" => "required"
),
);
Upvotes: 0
Views: 306
Reputation: 1378
You can add this validator in your InputFilter function:
array(
'name' => 'Regex',
'options' => array(
'pattern' => '/^[0-9_\.\,]*$/',
'messages' => array(
\Zend\Validator\Regex::INVALID => 'Your error message.',
),
),
),
And you can add your character need to be accept for your input in the patterns(Regular Expression).
I hope this helps.
Upvotes: 2