Welcome Guest, Not a member yet? Register   Sign In
Form validation: Callback not changing the input value
#8

[eluser]Nis Sarup[/eluser]
Yeah. I had originally named the function without the starting underscore, but read that that was a bad thing to do.

I just corrected those set_message's but it doesn't change anything.

Here is the signup function that runs the validation:
Code:
function signup()
        {
            $this->load->library(array('validation', 'email'));
            
            $rules['username']                = 'trim|required|min_length[5]|max_length[50]|callback__username_check|xss_clean|htmlentities';
            $rules['password']                = 'trim|required|matches[password_2]';
            $rules['password_2']            = 'trim|required';
            $rules['email']                     = 'trim|required|matches[email_2]|valid_email|callback__email_check';
            $rules['email_2']                = 'trim|required';
            $rules['first_name']            = 'trim|required|xss_clean';
            $rules['last_name']                = 'trim|required|xss_clean';
            $rules['state']                    = 'trim|required|exact_length[2]|alpha';
            $rules['street']                = 'trim|required';
            $rules['zip']                    = 'trim|required';
            $rules['birthday_month']        = 'trim|required';
            $rules['birthday_year']            = 'trim|required';
            $rules['birthday']                = 'trim|required|callback__validate_birthday';
            
            $this->validation->set_rules($rules);
            
            $fields['username']                = 'Username';
            $fields['password']                = 'Password';
            $fields['password_2']            = 'Repeated password';
            $fields['email']                 = 'Email';
            $fields['email_2']                = 'Repeated email';
            $fields['first_name']            = 'First name';
            $fields['middle_name']            = 'Middle name';
            $fields['last_name']            = 'Last name';
            $fields['phone']                = 'Phone';
            $fields['birthday_month']        = 'Birthmonth';
            $fields['birthday']                = 'Birthday';
            $fields['birthday_year']        = 'Birthyear';
            $fields['state']                = 'State';
            $fields['street']                = 'Street';
            $fields['street_2']                = 'Street 2';
            $fields['zip']                    = 'Zip';
            
            $this->validation->set_fields($fields);
            
            $data = array('title' => 'Sign up', 'where' => array('sale-rent' => false, 'buyer-renter' => false, 'forum' => false, 'blogs' => false));
            
            if ($this->validation->run() === false) {
                // Show the signup form
                // Either because it's the users first request
                // or because validation wasn't passed.
                $data['content'] = $this->load->view('user/signup', false, true);
            } else {
                die($this->input->post('birthday'));
                exit;
                // Success! Save the user, send an email, profit!
                $register = $this->redux_auth->register($this->input->post('username'), $this->input->post('password'), $this->input->post('email'));
                $data['content'] = $this->load->view('user/signup-success', false, true);
            }
                
            $this->load->view('main_template', $data);
        }
Maybe I missed something there.
I left in the die() for you. It outputs whatever I selected in the dropdown in the form. Not what the callback returns.


Messages In This Thread
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:08 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:13 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:16 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:24 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:27 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:35 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:38 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:42 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:43 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 05:58 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 06:05 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 06:20 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 06:33 AM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 12:21 PM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 12:24 PM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 12:49 PM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 01:31 PM
Form validation: Callback not changing the input value - by El Forum - 07-02-2009, 01:38 PM
Form validation: Callback not changing the input value - by El Forum - 07-09-2009, 08:50 AM
Form validation: Callback not changing the input value - by El Forum - 07-09-2009, 11:20 AM
Form validation: Callback not changing the input value - by El Forum - 07-09-2009, 11:52 AM
Form validation: Callback not changing the input value - by El Forum - 07-09-2009, 11:59 AM
Form validation: Callback not changing the input value - by El Forum - 07-16-2009, 10:27 PM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 08:23 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 09:42 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 11:00 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 11:18 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 11:58 AM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 12:26 PM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 01:53 PM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 04:21 PM
Form validation: Callback not changing the input value - by El Forum - 08-07-2009, 05:50 PM
Form validation: Callback not changing the input value - by El Forum - 09-03-2009, 12:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB