Form validation |
[eluser]loopyno[/eluser]
Hi guys, I really need your help because I am going crazy. I created a simple form on my site and I wanted to use the validation class. The only problem is that although - I think - I did all that is necessary to make it work I do not get an error message - neither for the form fields nor from the code I wrote ( so I understand that the code is correct ) What I realized is that $this->validation->error_messages does not get populated although I set the rules ( basic ones ) and the fields. The Controller code is below and you can se it not working here www.fuzzy-4x.com/contact. Any kind of help is really valued class Contact extends Controller { function Contact() { parent::Controller(); } function index() { $this->output->cache(0); $query = $this->db->query('SELECT text_name, text_value FROM texts where language = "'.$this->config->item('lang_selected').'"'); $temp = $query->result(); for($i=0; $i<count($temp); $i++) { $data[$temp[$i]->text_name] = $temp[$i]->text_value; } if(strlen($this->session->userdata('autohide')) < 1) { $this->session->set_userdata('autohide', 1); } $data['stop'] = $this->session->userdata('autohide'); $menu = array("home", "progress", "favorites", "about_me", "contact", "faq", "site_map"); if( !(in_array(trim($this->uri->segment(1)), $menu)) ) { if(strlen($this->session->userdata('current_page')) < 1) { $view = "home"; } else { $view = $this->session->userdata('current_page'); } } else { $view = trim($this->uri->segment(1)); } $rules['name'] = "required"; $rules['email'] = "required"; $rules['topic'] = "required"; $rules['message'] = "required"; $this->validation->set_rules($rules); $fields['name'] = 'contact_name'; $fields['email'] = 'contact_email'; $fields['topic'] = 'contact_topic'; $fields['message'] = 'contact_message'; $this->validation->set_fields($fields); $this->session->set_userdata('current_page', $view); $this->load->view('menu_view',$data); if ($this->validation->run() == FALSE) { $this->load->view('contact_view'); } else { $this->load->view('contact_success_view'); } $this->load->view('footer_view'); } } |
Messages In This Thread |
Form validation - by El Forum - 07-12-2008, 05:09 AM
Form validation - by El Forum - 07-12-2008, 05:17 AM
Form validation - by El Forum - 07-12-2008, 05:22 AM
Form validation - by El Forum - 07-12-2008, 05:31 AM
Form validation - by El Forum - 07-12-2008, 05:37 AM
Form validation - by El Forum - 07-12-2008, 05:51 AM
Form validation - by El Forum - 07-12-2008, 06:03 AM
Form validation - by El Forum - 07-12-2008, 06:39 AM
Form validation - by El Forum - 07-12-2008, 06:40 AM
Form validation - by El Forum - 07-12-2008, 07:06 AM
Form validation - by El Forum - 07-12-2008, 07:12 AM
Form validation - by El Forum - 07-12-2008, 07:14 AM
Form validation - by El Forum - 07-12-2008, 07:16 AM
Form validation - by El Forum - 07-12-2008, 07:19 AM
Form validation - by El Forum - 07-25-2008, 01:46 PM
|