CodeIgniter Forums
Callbacks: Your own Validation Functions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18)
+--- Thread: Callbacks: Your own Validation Functions (/showthread.php?tid=11)



Callbacks: Your own Validation Functions - startbbs - 10-21-2014

it can only call public functions in Form Validation. can not call private function.
is it a bug?


RE: Callbacks: Your own Validation Functions - Rufnex - 10-21-2014

can you post an example


RE: Callbacks: Your own Validation Functions - michalsn - 10-21-2014

It's not a bug - it's a feature ;)

Try to use CI private function as workaround:
PHP Code:
public function _my_callback() {} 



RE: Callbacks: Your own Validation Functions - tirta - 10-22-2014

IMHO in use Callbacks Form Validation is a bad practice and it doesn't make any sense. Better extends the Form Validation Library and create your own validation rules.


RE: Callbacks: Your own Validation Functions - Narf - 10-22-2014

(10-21-2014, 07:51 PM)startbbs Wrote: it can only call public functions in Form Validation. can not call private function.
is it a bug?

Private functions can only be called by the class that declares them and this has nothing to do with CodeIgniter.


RE: Callbacks: Your own Validation Functions - projack89 - 10-22-2014

(10-22-2014, 01:28 AM)tirta Wrote: IMHO in use Callbacks Form Validation is a bad practice and it doesn't make any sense. Better extends the Form Validation Library and create your own validation rules.

I agree with you