Welcome Guest, Not a member yet? Register   Sign In
Passing extra data to callback.
#1

[eluser]Unknown[/eluser]
I found a post related to CI 1.63 that showed how to pass extra data to a call back using the following code.

Code:
$this->form_validation->set_rules('username', 'Username', 'callback_username_check['.$id.']');

and then you can setup your callback function to receive more than 1 argument

Code:
function username_check($str, $id) {}

However this doesn't seem to be in the documentation. Is this bad practice or deprecated?

I have seen other posts that suggest that you should use variables or post/get data within your callback in order to use data other than the form field passed however this does break encapsulation.

Thanks!


Messages In This Thread
Passing extra data to callback. - by El Forum - 02-03-2011, 06:45 AM
Passing extra data to callback. - by El Forum - 02-08-2011, 07:35 PM
Passing extra data to callback. - by El Forum - 02-10-2011, 07:51 AM
Passing extra data to callback. - by El Forum - 02-10-2011, 01:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB