Question about Validator class please.

edited January 2013 in Modules
I have question about Validator class please.

For this method,

$this->validator->add_rule('phone', 'required', 'The name field is required', $posted['phone']); // If I would like to check for decimal number (Rule from form_validation in CI) $this->validator->add_rule('phone', 'numeric', 'The phone field must be a number', $posted['phone']);

It gave me this error,

A PHP Error was encountered

Severity: Warning

Message: call_user_func_array() expects parameter 1 to be a valid callback, function 'numeric' not found or invalid function name

Filename: libraries/Validator.php

How could I combine the rules from CI and Fuel CMS?

Thank you very much.

Comments

  • edited 2:43PM
    You can use an array syntax for the function call like so array($this->validation, 'numeric'), or you could simply use the native "is_numeric" function. The CI validation library must first be loaded though.
Sign In or Register to comment.