Welcome Guest, Not a member yet? Register   Sign In
Can't get the Form Validation library to work
#1

[eluser]AlexJ[/eluser]
Hello,

My Form Validation works (it returns false if a field is not OK, and it returns true when all the fields are correct), but it doesnt show any validation errors, I traced it down to the following bit of code:

Code:
function &_get_validation_object()
  {
      $CI =& get_instance();

      // We set this as a variable since we’re returning by reference
      $return = FALSE;

      if ( ! isset($CI->load->_ci_classes) OR ! isset($CI->load->_ci_classes[‘form_validation’]))
      {
        return $return;
      }

      $object = $CI->load->_ci_classes[‘form_validation’];

          // $object = “form_validation”
          // $CI->$object doesn’t exist: Undefined property: Webshop::$form_validation
      if ( ! isset($CI->$object) OR ! is_object($CI->$object))
      {
                // returns false, so an empty validation_errors() occurs even when some of the rules arent satisfied.
        return $return;
      }

      return $CI->$object;
  }

One little note about the Webshop controller, it extends a custom Controller named V_Controller, which extends the native controller and adds some methods.

I am not really familiar with the inner working of CodeIgniter so I have no idea how to fix this.

Anyone?

Edit: I think it is because the validation_errors is called from a view file, for some reason my libraries are not available in view files (maybe because I use a extending controller?)

This occurs even when I autoload the libraries.


Messages In This Thread
Can't get the Form Validation library to work - by El Forum - 12-15-2009, 04:05 AM
Can't get the Form Validation library to work - by El Forum - 12-15-2009, 04:21 AM
Can't get the Form Validation library to work - by El Forum - 12-15-2009, 04:26 AM
Can't get the Form Validation library to work - by El Forum - 12-15-2009, 08:11 AM
Can't get the Form Validation library to work - by El Forum - 12-15-2009, 08:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB