Tag Archives: callback

Multiple Argument in CodeIgniter’ s Form Validation Callback

CodeIgniter have a powerful form validation class out of the box. We also can create our validation method using a callback. By default, “callback” just accept 1 argument. I didn’t found in user guide, how to make callback accept more than 1 argument.

But, after doing little googling i found a way to do it. For example:

$val->set_rules('field', 'Field Name', "trim|xss_clean|required|callback__example_callback[{$argument}]")
......

function _example_callback($default_argument, $argument) {

.......

See the bold text. Done. 🙂