Skip to content

Conversation

salvatorelapi
Copy link

Hi, i use this code
$validator
->required('You must supply telephone.')
->callback(function($val) {
return (preg_match('/^[0-9]{1,}$/', $val, $matches) === FALSE) ? false : true;
}, "Must be a Number")
->validate('telephone', 'Telephone');

To validate telephone number, but if field is invalid return this resulset:
[validData:protected] => Array
(
[telephone] => SAsa
)
as valid data. Can you help me? Thanks!

cgutierrez and others added 30 commits April 2, 2011 19:41
… this class can be used for validation beyond forms. added support for validating whole arrays. @cballou added support for dot notation in get val to reference array values. awesome library
…d value parameter (i.e. string/array) to the callback function.
…callback function with the correct arguments in both cases.
… Also tweaked documentation and added a section on example callbacks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants