I have a numeric input field that is allowed to be empty, but if is not empty I'd like to return a validation error if letters are entered for example.
at the moment if I removed allow empty validation works just fine for both numeric and notEmpty but this field is optional how can I fix this?
Here is the validation on my model:
'tickets' => array(
'numeric' => array(
'rule' => 'numeric',
'message' => 'Please enter only numbers',
'allowEmpty' => true,
),
),
once again if I set allowEmpty to false this works as expected. I've been playing around with it by separating the rules, but so far no luck. Any help is appreciated.