{"action":"created","issue":{"url":"https://api.github.com/repos/chriskacerguis/codeigniter-restserver/issues/586","repository_url":"https://api.github.com/repos/chriskacerguis/codeigniter-restserver","labels_url":"https://api.github.com/repos/chriskacerguis/codeigniter-restserver/issues/586/labels{/name}","comments_url":"https://api.github.com/repos/chriskacerguis/codeigniter-restserver/issues/586/comments","events_url":"https://api.github.com/repos/chriskacerguis/codeigniter-restserver/issues/586/events","html_url":"https://github.com/chriskacerguis/codeigniter-restserver/issues/586","id":119226226,"number":586,"title":"Form_Validation issue","user":{"login":"hosseinsalemi","id":651249,"avatar_url":"https://avatars.githubusercontent.com/u/651249?v=3","gravatar_id":"","url":"https://api.github.com/users/hosseinsalemi","html_url":"https://github.com/hosseinsalemi","followers_url":"https://api.github.com/users/hosseinsalemi/followers","following_url":"https://api.github.com/users/hosseinsalemi/following{/other_user}","gists_url":"https://api.github.com/users/hosseinsalemi/gists{/gist_id}","starred_url":"https://api.github.com/users/hosseinsalemi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hosseinsalemi/subscriptions","organizations_url":"https://api.github.com/users/hosseinsalemi/orgs","repos_url":"https://api.github.com/users/hosseinsalemi/repos","events_url":"https://api.github.com/users/hosseinsalemi/events{/privacy}","received_events_url":"https://api.github.com/users/hosseinsalemi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-27T17:08:16Z","updated_at":"2016-05-04T10:08:53Z","closed_at":null,"body":"I'm using `form_validation` and write validation rules in `config/form_validation.php`. In validation rules I add some functions, for example trim() to trim input data.\r\n\r\n    $this->form_validation->set_data( $this->post() );\r\n    if ($this->form_validation->run() != FALSE)\r\n    {\r\n        // get input but not validated data :(\r\n        $input = $this->post();\r\n    }\r\n\r\nbut when call `$this->post()`, data didn't trim! How can I get validated data?"},"comment":{"url":"https://api.github.com/repos/chriskacerguis/codeigniter-restserver/issues/comments/216819795","html_url":"https://github.com/chriskacerguis/codeigniter-restserver/issues/586#issuecomment-216819795","issue_url":"https://api.github.com/repos/chriskacerguis/codeigniter-restserver/issues/586","id":216819795,"user":{"login":"fernandodeveloper","id":12852195,"avatar_url":"https://avatars.githubusercontent.com/u/12852195?v=3","gravatar_id":"","url":"https://api.github.com/users/fernandodeveloper","html_url":"https://github.com/fernandodeveloper","followers_url":"https://api.github.com/users/fernandodeveloper/followers","following_url":"https://api.github.com/users/fernandodeveloper/following{/other_user}","gists_url":"https://api.github.com/users/fernandodeveloper/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandodeveloper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandodeveloper/subscriptions","organizations_url":"https://api.github.com/users/fernandodeveloper/orgs","repos_url":"https://api.github.com/users/fernandodeveloper/repos","events_url":"https://api.github.com/users/fernandodeveloper/events{/privacy}","received_events_url":"https://api.github.com/users/fernandodeveloper/received_events","type":"User","site_admin":false},"created_at":"2016-05-04T10:08:53Z","updated_at":"2016-05-04T10:08:53Z","body":"Check content put\n\nVar_dump($this->put()) or print_r($this-put())\n\nSend result of this.\nEm 4 de mai de 2016 3:45 AM, \"amitkm040\" <notifications@github.com>\nescreveu:\n\nmy MY_Form_valiation.php\n<?php\n\nclass MY_Form_validation extends CI_Form_validation {\nfunction __construct($rules = array()) {\nparent::__construct($rules);\n$this->ci =& get_instance();\n}\n\npublic function get_errors_as_array() {\nreturn $this->_error_array;\n}\n\npublic function get_config_rules() {\nreturn $this->_config_rules;\n}\n\npublic function get_field_names($form) {\n$field_names = array();\n$rules = $this->get_config_rules();\n$rules = $rules[$form];\nforeach ($rules as $index => $info) {\n$field_names[] = $info['field'];\n}\nreturn $field_names;\n}\n}\n\nmy form_validation.php\n\n<?php if( ! defined('BASEPATH') ) exit('No direct script access allowed');\n\n$config = array(\n\n'student_put' => array(\narray( 'field' => 'email_address', 'label' => 'email_address', 'rules' =>\n'trim|required|valid_email' ),\narray( 'field' => 'password', 'label' => 'password', 'rules' =>\n'trim|required|min_length[8]|max_length[16]' ),\narray( 'field' => 'first_name', 'label' => 'first_name', 'rules' =>\n'trim|required|max_length[50]' ),\narray( 'field' => 'last_name', 'label' => 'last_name', 'rules' =>\n'trim|required|max_length[50]' ),\narray( 'field' => 'phone_number', 'label' => 'phone_number', 'rules' =>\n'trim|required|alpha_dash' )\n)\n\n);\n?>﻿\n\nmy student_put function\n\nfunction student_put(){\n$this->load->library('form_validation');\n\n$this->form_validation->set_data($this->put()) ;\nif ($this->form_validation->run('student_put') != false){\n$this->load->model('Model_students');\n$student = $this->put();\n$student_id = $this->Model_students->insert($students);\nif (!$student_id) {\n$this->response(array('status'=>'failure','message'=>'An un-expected error\noccured while trying to insert student\ndetails'),REST_Controller::HTTP_INTERNAL_SERVER_ERROR);\n}\nelse {\n$this->response(array('status'=> 'success','message'=>'Student data\nsuccessfully inserted'));\n}\n}else {\n$this->response(array('status'=>\n'failure','message'=>$this->form_validation->get_errors_as_array()),\nREST_Controller::HTTP_BAD_REQUEST);\n}\n\n}\n\nI am getting this error even after filling all required filled\n\n{\n\"status\": \"failure\",\n\"message\": {\n\"email_address\": \"The email_address field is required.\",\n\"password\": \"The password field is required.\",\n\"first_name\": \"The first_name field is required.\",\n\"last_name\": \"The last_name field is required.\",\n\"phone_number\": \"The phone_number field is required.\"\n}\n}\n\nCan anybody please help me out , Thanks in advance\n\n—\nYou are receiving this because you commented.\nReply to this email directly or view it on GitHub\n<https://github.com/chriskacerguis/codeigniter-restserver/issues/586#issuecomment-216759542>\n"}}