Welcome Guest, Not a member yet? Register   Sign In
Validation callback function inside model
#11

[eluser]gtech[/eluser]
sorry didn't mean to put you down its not easy starting out on a new technology, and I dont know half of CI. I just strongly believe validation belongs in the controller and you call the model in the callback functions, you are doing something the validation code isnt designed to do.. I will take a look at how the callback functionality works for you.

[edit]
where are your loading your validation library?, in the controller or in the model? If I understand the validation code correctly(which is debatable) the callback function works by storing a reference to the code its initialised by in $this->CI. It then parses out "callback_" and stores the function name in $rule... The callback looks like this: $this->CI->$rule(......
#12

[eluser]Base Willy[/eluser]
gtech, I'm loading validation lib in the model. I think i could just leave callback funcs in the controller to make things simple Smile
#13

[eluser]gtech[/eluser]
Ok sounds good to me... im off for a coffee Smile

obviously $this->CI is the controller instance the model was called from, and you may have to rewrite the validation.php code to load a callback in the model (yuck!). Thanks though, I have learned a lot more about how validation works!
#14

[eluser]Base Willy[/eluser]
gtech, not at all, thank you=)




Theme © iAndrew 2016 - Forum software by © MyBB