Codeigniter : Zurücksetzen des Formulars Werte

In meinem Blick, was ich tun will ist klar, die form-Felder, sobald der Benutzer erfolgreich registriert wurde. Alles funktioniert hier also ist der Benutzer registriert, Erfolg Nachricht wird dem Benutzer angezeigt, außer, dass das, was ich will zu tun, ist das klar, die Werte der Formularfelder, für die ich bin mit diesem

//Clear the form validation field data, so that it doesn't show up in the forms
$this->form_validation->_field_data = array();

Nachdem ich Hinzugefügt, das CI gibt mir immer diese Fehlermeldung:
Fatal error: Cannot access protected property CI_Form_validation::$_field_data in

C:\wamp\www\CodeIgniter\application\controllers\user.php on line 92

Hier ist die entsprechende controller-code:

public function signup()
{
    //If the user is logged in, don't allow him to view this page.
    if (($this->_isLoggedIn()) === true) {
        $this->dashboard();
    }
    else
    {
        $data['page']       = 'signup';
        $data['heading']    = 'Register yourself';
        $data['message']    = $this->_regmsg;

        $this->load->library('form_validation');

        //$this->form_validation->set_rules('is_unique', 'Sorry! This %s has already been taken. Please chose a different one.');

        $this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[12]|is_unique[users.username]|callback_valid_username');
        $this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]');
        $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');

        //run will return true if and only if we have applied some rule all the rules and all of them are satisfied
        if ($this->form_validation->run() == false) {

             $data['errors'] = isset($_POST['submit']) ? true : false;
            $data['success'] = false;

            $this->_load_signup_page($data);
        }
        else{
            if($this->users->register_user($_POST)){
                 $data['errors'] = false;
                $data['success'] = true;

                //Clear the form validation field data, so that it doesn't show up in the forms
                $this->form_validation->_field_data = array();

                $this->_load_signup_page($data);
            }
        }
    }
}

private _load_signup_page($data){
    $this->load->view('template/main_template_head');
    $this->load->view('template/blue_unit', $data);
    $this->load->view('signup', $data);
    $this->load->view('template/main_template_foot');
}

Kann jemand bitte sagen Sie mir, was ist der deal mit dieser Zeile?

$this->form_validation->_field_data = array();

P. S: Hier ist, wie zeige ich die Werte in der form:

<?php echo set_value('fieldname'); ?>
InformationsquelleAutor Kamran Ahmed | 2013-10-14
Schreibe einen Kommentar