Welcome Guest, Not a member yet? Register   Sign In
Callback when using form_validation.php $config array
#2

[eluser]Iván Argulo[/eluser]
I think the best way to do this is having a function (as you say at #3, better if private), something like this:

Code:
array(
    'field' => 'choice',
    'label' => 'Dropdown Choice',
    'rules' => 'required|is_natural_no_zero|callback_in_domain' // NOTE: no params passed                
)

and your function

Code:
function in_domain($form_value) {
    // Do all stuff here
}

Note that you can pass only one param, the value of the current field. So you'll have to write several functions for your tables, or store the name of the table to check in a session, before loading the validation rules, and check for it in the callback.

Hope it helps


Messages In This Thread
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 01:17 PM
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 01:23 PM
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 01:33 PM
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 01:39 PM
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 01:51 PM
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 01:56 PM
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 01:56 PM
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 02:13 PM
Callback when using form_validation.php $config array - by El Forum - 07-14-2009, 02:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB