Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback function #3

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open

Callback function #3

wants to merge 35 commits into from

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