Problem with creating sets of rules - 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: Problem with creating sets of rules (/showthread.php?tid=36258) |
Problem with creating sets of rules - El Forum - 11-26-2010 [eluser]Unknown[/eluser] Hi everyone! I've been working with CodeIgniter for a while and it is amazing. I have a little problem here. I'm trying to validate a form with the sets of rules and I can't seem to be able to make it work. I did some test and the file_validation.php file is loaded. I have no idea what is the problem. Does someone have an idea ? Thank You. Here is my code : My controller file : <?php class Quoi_de_neuf extends Controller { function Quoi_de_neuf() { parent::Controller(); } function index() { } function abonnez_vous_a_notre_infocite() { $this->load->model("quoi_de_neuf_model", "quoi_de_neuf"); $data["array_of_background"] = array("media/images/bgd/home.jpg"); $data["css_files"] = array(minify(array_merge($this->config->item("default_css"), array("quoi-de-neuf.css")), "css")); $data["js_files"] = array(minify(array_merge($this->config->item("default_js"), array("sub-menu.js")), "js")); $data["content_view"] = "quoi_de_neuf/abonnez_vous_a_notre_infocite_view"; $data["title"] = "Abonnez-vous à notre infocité"; $data["start_year_for_birth"] = 1900; $data["end_year_for_birth"] = 2010; $data["saved_result"] = $this->session->flashdata("saved_result"); $data["default_email"] = $this->input->post("txt_email_infocite"); if (isset($_POST["btn_envoyer"]) == true) { $this->load->library("form_validation"); if ($this->form_validation->run("infocite_required") == true) { // Some stuff } else { // Some stuff } redirect("quoi-de-neuf/abonnez-vous-a-notre-infocite"); } $this->load->view("templates/main_view", $data); } } My form validation file : <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $config = array ( "infocite_required" => array ( array ( "field" => "txt_nom", "label" => "Nom", "rules" => "required" ) ) ); |