Welcome Guest, Not a member yet? Register   Sign In
Extending Form Validation
#2

[eluser]Whit Nelson[/eluser]
Ok,

So I added this extension to the Form Validation class. It is from this blog entry here:

http://www.haloweb.co.uk/blog/2009/03/co...ion-class/

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class MY_Form_validation extends CI_Form_validation {

    function My_Form_validation()
    {
        parent::CI_Form_validation();
    }

    // --------------------------------------------------------------------

    /**
     * Set Error
     *
     * @access  public
     * @param   string
     * @return  bool
    */  

    function set_error($error = '')
    {
        if (empty($error))
        {
            return FALSE;
        }
        else
        {
            $CI =& get_instance();

            $CI->form_validation->_error_array['custom_error'] = $error;

            return TRUE;
        }
    }

}

?>

This code allows me to create new errors which show up when I call validation_errors(), but I need to display each error individually. I am currently using form_error('rule') to do that. Can anyone shed any light on this?

Thanks,

Whit


Messages In This Thread
Extending Form Validation - by El Forum - 09-20-2009, 12:49 PM
Extending Form Validation - by El Forum - 09-21-2009, 04:17 PM
Extending Form Validation - by El Forum - 09-21-2009, 05:24 PM
Extending Form Validation - by El Forum - 10-14-2009, 10:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB