Welcome Guest, Not a member yet? Register   Sign In
Associating a Controller Function with a Rule Group
#1

[eluser]Unknown[/eluser]
Hello

Let me begin by saying that I've just started using CodeIgniter and I think it's great.
I really enjoy using the form_validation class and I think that the ability to associate a controller function with a validation rule group is awesome.
I've used this feature and everything worked out great until I've tried to associate a controller function that takes paramenters with a rule group.
For example:
Code:
class Test extends Controller{
  function thisFunction(){
     $this->form_validation->run();
  }
}
fires the "test/thisFunction" rule group as expected.
But
Code:
class Test extends Controller{
  function thisFunction($paramA,$paramB){
    $this->form_validation->run();
  }
}
doesn't trigger the validation. I've also noticed that if you name the rule group like 'controller/function/firstValue/secondValue' the validation will run if the function is called with those exact values as parameters.
I am aware that I can simply name the validation group and just call $this->form_validation->run('groupName'), and that's actually what I've ended up doing, but I'm just wondering if there is a proper way to associate a controller function that takes parameters with a rule group.
Thank you.




Theme © iAndrew 2016 - Forum software by © MyBB