CodeIgniter Forums
form_validation->run() Problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: form_validation->run() Problem (/thread-25553.html)



form_validation->run() Problem - El Forum - 12-16-2009

[eluser]Unknown[/eluser]
form_validation->run() don't return FALSE and/or TRUE.

Controller:
Code:
class Registration extends Controller
{
    function Registration()
    {
        parent::Controller();
        $this->load->scaffolding('cms_users');
        $this->load->helper('url');
        $this->load->helper('form');
        
    }
    function index()
    {
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        //ogni errore sarà contenuto nel class div error
        $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
        
        $data['title']="Registrazione Utente";
        $data['heading']="Form di registrazione";
        $data['query']=$this->db->get('cms_users');
        $this->db->select('*');
        $this->db->order_by('name','asc');
        $data['nation']=$this->db->get('cms_nation');
        $this->db->select('*');
        $this->db->order_by('prov_name','asc');
        $data['province']=$this->db->get('cms_province');
        
        //verifico se la registrazione ha degli errori
        //echo $this->form_validation->run();
        
        $this->form_validation->set_rules('surname', 'Cognome', 'trim|required|xss_clean');
        $this->form_validation->set_rules('name', 'Nome', 'trim|required|xss_clean');
        $this->form_validation->set_rules('rag_sociale', 'Ragione Sociale', 'trim|required|xss_clean');
        $this->form_validation->set_rules('nation', 'Nazione', 'trim|required|xss_clean');
        $this->form_validation->set_rules('province', 'Provincia', 'trim|required|xss_clean');
        $this->form_validation->set_rules('zip_code', 'CAP', 'trim|required|xss_clean');
        $this->form_validation->set_rules('city', 'Citt&agrave;', 'trim|required|xss_clean');
        $this->form_validation->set_rules('address', 'Indirizzo', 'trim|required|xss_clean');
        $this->form_validation->set_rules('phone', 'Recapito', 'trim|required|xss_clean');
        $this->form_validation->set_rules('fax', 'Fax', 'trim|required|xss_clean');
        $this->form_validation->set_rules('birth_date', 'Data di Nascita', 'trim|required|xss_clean');
        $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|xss_clean');
        $this->form_validation->set_rules('web', 'Sito Web', 'trim|required|xss_clean');
        $this->form_validation->set_rules('gender', 'Sesso', 'trim|required|xss_clean');
        $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean|callback_username_check');
        $this->form_validation->set_rules('password', 'Password', 'trim|required|md5');
        //$this->form_validation->set_rules('password_conf', 'Ripeti Password', 'trim|required');
        
        if ($this->form_validation->run() == FALSE)
        {
            $this->load->view('registration_view',$data);
        }
        // o se è andata a buon fine
        else
        {
            $this->db->insert('cms_users',$_POST); //insert(db colum,$_POST);
            $this->load->view('registration_success');
        }
    }
}

where did i have wrong?


form_validation-&gt;run() Problem - El Forum - 12-24-2009

[eluser]Unknown[/eluser]
Yes I have same problem this. Is there wrong configuration? where? thanks a lot