Welcome Guest, Not a member yet? Register   Sign In
passing array to custome form validation function
#1

[eluser]Unknown[/eluser]
Hi all
lets say that $x contains array of ids
i want to validate this array using callback_duplicate,i do the following:
$this->form_validation->set_rules('x[]',..., 'trim|required|callback_duplicate['.$x.']');

and the function is:
function duplicate($x)
{...........}

but the previous statement only pass the first element to the function, not all array
how to pass array to custom form validation function
thank you
#2

[eluser]Fireclave[/eluser]
$this->form_validation->set_rules(‘x’,..., ‘trim|required|callback_duplicate’);

write the x without the [], then should it works.




Theme © iAndrew 2016 - Forum software by © MyBB