Welcome Guest, Not a member yet? Register   Sign In
Extended form validation and blank fields
#8

[eluser]urrmurrmur[/eluser]
I extended the form_validation library and made a new class, MY_Form_validation. below is the code.

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

class MY_Form_validation extends CI_Form_validation {

    function My_Form_validation($rules = array())
    {
        parent::CI_Form_validation($rules);
    }
    
    function array_has_values($array)
    {
        $this->CI->form_validation->set_message( 'array_has_values', 'U moet minstens één parameter selecteren' );
        return !empty($array);
    }
    
    function lamosaurus( $str )
    {
        $this->CI->form_validation->set_message( 'lamosaurus', 'LAMOSAURUS!' );
        return FALSE;
    }
}

?>

I don't think there's anything wrong with the way I extend the class, since it does actually execute the function as expected when the field is not blank.

Ignore the function array_has_values for now, it's just a stub.


Messages In This Thread
Extended form validation and blank fields - by El Forum - 06-04-2010, 05:23 AM
Extended form validation and blank fields - by El Forum - 06-04-2010, 07:05 AM
Extended form validation and blank fields - by El Forum - 06-04-2010, 08:45 AM
Extended form validation and blank fields - by El Forum - 06-09-2010, 02:52 AM
Extended form validation and blank fields - by El Forum - 06-09-2010, 03:07 AM
Extended form validation and blank fields - by El Forum - 06-14-2010, 07:44 AM
Extended form validation and blank fields - by El Forum - 06-14-2010, 08:49 AM
Extended form validation and blank fields - by El Forum - 06-17-2010, 05:51 AM
Extended form validation and blank fields - by El Forum - 06-17-2010, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB