I'd really appreciate some help with this its been driving me nuts. I'm trying to validate numbers submitted by a zend form either in the form of integers or decimals (2 decimal places) allowing for 0 or 0.00 but not empty inputs.
$form->element->addValidator ('regex', false, array(
'pattern'=>'/^\d+(\d{1,5})?(\.\d{1,2})?$/',
'messages'=>array(
'regexInvalid'=>'required',
'regexNotMatch'=>'number required')
)
);
For some reason a float like 100.00 generates the following validation error message: "'100.00' contains characters which are not digits; but only digits are allowed". The regexNotMatch message or regexInvalid message aren't generated which is what I'd expect.
This validation error message seems to be generated by the digits validator which I'm not calling is there something I can do to stop it kicking in?
Also empty inputs aren't generating any validation error messages.
If I try a string like 'rt67' my regexNotMatch message is displayed correctly.
I'm using zend components without the mvc if this makes any difference.