Welcome Guest, Not a member yet? Register   Sign In
Form validation groups
#1

[eluser]a77icu5[/eluser]
I got my validation groups in config/form_validation.php

Code:
$config = array(
   'users/create' => array(
      ...fancy validation rules
   )

   'users/profile' => array(
      ...fancy validation rules
   )
);

then...in the controller, my validation rules are mapped when I do this
Code:
class Users extends Controller
{
   public function __construct() {
      parent::Controller();
      $this->load->library('form_validation');
   }

   public function create() {
      ...some code here
      if ($this->form_validation->run() == false) {
         ...error view
      }
   }

   public function profile($user) {
      ...some fancy code here
      if ($this->form_validation->run() == false) {
         ...error view
      }
   }
}

When the validation run inside create() everything's ok...but, when the validation run inside profile, run() don't call my group unless I removed $user...why?
#2

[eluser]a77icu5[/eluser]
[CLOSED]

Setting the group inside run...everything is ok =D
Code:
public function profile($user) {
      ...some fancy code here
      if ($this->form_validation->run('users/profile') == false) {
         ...error view
      }
   }




Theme © iAndrew 2016 - Forum software by © MyBB