CodeIgniter Forums
empty set_value() after a submit - 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: empty set_value() after a submit (/showthread.php?tid=19439)



empty set_value() after a submit - El Forum - 06-07-2009

[eluser]Xeoncross[/eluser]
I was trying to skimp on code and left off the return FALSE statements in my callbacks as PHP functions naturally return a false value with no return type.

Code:
function email_check($email) {

    if ($this->auth->is_email_available($email)) {
        return TRUE;
    }

    $this->form_validation->set_message('email_check', 'Email is already used by another user.');
}

This will not work - you will wind up with an empty set_value() as the form_validation lib uses is_bool() to check the returned result of the callbacks.

Quote:If your callback returns anything other than a boolean TRUE/FALSE it is assumed that the data is your newly processed form data.

Maybe having this here will help someone that searches the forum.