CodeIgniter Forums
Callback function being called twice if use more than one callbacks - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Callback function being called twice if use more than one callbacks (/showthread.php?tid=46012)



Callback function being called twice if use more than one callbacks - El Forum - 10-14-2011

[eluser]coldfire82[/eluser]
Hi,

My CI Version is: 2.0.3

My form validation rule looks like this,

Code:
$this->form_validation->set_rules('email', 'Email', 'trim|required|max_length[45]|valid_email|callback_check_email|callback_check_expiry_date');

In check_email callback i am adding a record in my table. Afterwards, when I appended a new callback in the same rule i.e. "callback_check_expiry_date", I found out that the earlier callback_check_email is executing twice as I checked my db table and there were two records instead of just one. And when I removed the second callback, it was executing correctly and added one record.

Why is it so ?

Although I have now removed my second callback and doing the work in just one callback but still curious, why ?