Welcome Guest, Not a member yet? Register   Sign In
problem with extending class
#1

[eluser]taschentuch[/eluser]
hi i wanna extend the form_validation class but i got this error:

Code:
Fatal error: Call to undefined method CI_Form_validation::test() in /var/www/system/application/controllers/admin/User.php on line 46

MY_Validation.php

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Validation extends CI_Form_validation
{
    function MY_Validation()
    {
        parent::CI_Form_validation();
        $this->CI = &get;_instance();
    }

    function test()
    {
         //mycode
    }
}

controllers/admin/user.php line 46:

Code:
$this->form_validation->test();
#2

[eluser]imn.codeartist[/eluser]
please refer this thread I hope your solution is there

http://ellislab.com/forums/viewthread/132164/
#3

[eluser]taschentuch[/eluser]
thx but something is still wrong :/

Quote:Fatal error: Call to undefined function test() in /var/www/system/application/controllers/admin/User.php on line 47

MY_Form_Validation.php

Code:
class MY_Form_validation extends CI_Form_validation

{
    function MY_Form_validation()

    {

        parent::CI_Form_validation();

        $this->CI = &get;_instance();

        log_message('debug', 'MY_Form_validation class loaded');

    }

    function test()
    {
    echo 'works';
    }
}

controller:
Code:
$this->load->library('form_validation');
            if($this->form_validation->run() === FALSE)
        {
        $this->form_validation>test();
                }

i cant find the error...

the last log entry:

DEBUG - 2009-11-10 13:21:27 --> Form Validation Class Initialized
but MY_Form_validation not loaded :/
#4

[eluser]Colin Williams[/eluser]
Should be MY_Form_validation.php (lowercase "v")
#5

[eluser]taschentuch[/eluser]
have it so

here my controller and library
#6

[eluser]LuckyFella73[/eluser]
I don't know if thats the problem but there is a "-" missing:

Code:
$this->form_validation>test();

// should be:
$this->form_validation->test();
#7

[eluser]Zack Kitzmiller[/eluser]
get;->instance()

should be get_instance();
#8

[eluser]LuckyFella73[/eluser]
[quote author="techneke" date="1257885854"]get;->instance()

should be get_instance();[/quote]

That's what I thought first too but posted the corrected
call in CODE-tags the script is overwritten like that.
#9

[eluser]taschentuch[/eluser]
ah thx works now my editor has no syntax highlighting and havent seen this error :/




Theme © iAndrew 2016 - Forum software by © MyBB