Welcome Guest, Not a member yet? Register   Sign In
Form_validation question
#1

Hi everybody, I'm developing a web application using this excellent framework (Codeigniter 3.0RC3)
Someone could help me whith this doubt.

I'm using form_validation library to validate data within models. I use the set_data method to validate an associative array. This is my validate method.

Code:
public function validate($data, $rules) {
        $this->form_validation->set_data($data);
        $this->form_validation->set_rules($rules);

        if ($this->form_validation->run() == FALSE) {
            return FALSE;
        }
        else {
            return $data;
        }
    }

Some validations rules are like this

Code:
$rules[] = array("field" => "description", "label"=> "Description", "rules"=> "trim|strip_tags");

After validation process takes place, $data["description"] is not trimmed and tags striped. The only way I can do this is re-populating $data array using set_value() function for each of the array items. For example

$data["description"] = set_value("description");

Thanks in advance guys.
Reply


Messages In This Thread
Form_validation question - by jonyr - 03-16-2015, 10:52 AM
RE: Form_validation question - by Avenirer - 03-17-2015, 12:19 AM
RE: Form_validation question - by RobertSF - 03-17-2015, 03:28 AM
RE: Form_validation question - by Avenirer - 03-17-2015, 03:50 AM
RE: Form_validation question - by RobertSF - 03-17-2015, 03:59 AM
RE: Form_validation question - by mwhitney - 03-17-2015, 07:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB