Welcome Guest, Not a member yet? Register   Sign In
CI 1.7 - Form Validation Config File rules are lost if there are additional uri segments
#1

[eluser]JayTee[/eluser]
This isn't really a 'bug' per se, but it cost me 1/2 hour of problem solving:

Scenario:
http://www.example.com/index.php/control...ion/param1

contains a form that posts to itself using the uri_string() function:
Code:
<form action="http://www.example.com/index.php/controller/function/param1">

but your application/config/form_validation.php file shows the rule like this:
Code:
$config = array(
  'controller/function' => array(
    array(
      'field' => 'login',
      'label' => 'Login Name',
      'rules' => 'required'
    ),
    array(
      'field' => 'password',
      'label' => 'Password',
      'rules' => 'required'
    )
  )
);

In this scenario, the validation class will not find the validation rule - because it's looking for a rule called 'controller/function/param1'!

I changed the form so that it posts to the controller's function directly rather than cheating and using the uri segments in lieu of hidden form fields.

I'm sure this is by design; it can also be a 'gotcha' if a user happens to be posting a form to a URL that contains additional uri segments.


Messages In This Thread
CI 1.7 - Form Validation Config File rules are lost if there are additional uri segments - by El Forum - 11-17-2008, 10:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB