Welcome Guest, Not a member yet? Register   Sign In
validation errors output
#1

[eluser]Bacteria Man[/eluser]
Here's a simple tip, which might save somebody a couple of minutes.

The default output of each validation error is wrapped in paragraph tags. I wanted to use list item tags.

Fortunately the Validation class defines two properties, _error_prefix and _error_suffix, which makes it easy to change them. Create an extended class (if you haven't previously done so) and define the new values in the Constructor.

Code:
class My_Validation extends CI_Validation
{
    /**
     * Constructor
     *
     */    
    function My_Validation()
    {    
        parent::CI_Validation();
        $this->_error_prefix = '<li>';
        $this->_error_suffix = '</li>';
    }
}


Messages In This Thread
validation errors output - by El Forum - 07-30-2007, 05:23 PM
validation errors output - by El Forum - 07-30-2007, 05:26 PM
validation errors output - by El Forum - 07-30-2007, 06:42 PM
validation errors output - by El Forum - 07-31-2007, 03:49 PM
validation errors output - by El Forum - 07-31-2007, 03:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB