• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validation callback function inside model

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.

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(......

[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

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!

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.