• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MY_Form_validation problem

#1
[eluser]brixxster[/eluser]
Hello guys,

Everything works fine locally but when I uploaded my files to the server I get an error:

Code:
Unable to load the requested class: my_form_validation

Does it have to do with how I call the custom library in my controller?
Code:
$this->load->library('my_form_validation');

The actual file that it's looking for is..
Quote:application/libraries/MY_Form_validation.php

Please help. Does it have to do with the filename?

Thanks in advance.

#2
[eluser]Nick_MyShuitings[/eluser]
Check your filenames and naming conventions. Linux is a lot more case sensitive then Windows is in these matters. I'm not at my dev desk or else I'd run a test but the docs are pretty clear:

http://ellislab.com/codeigniter/user-gui...asses.html

File name: MY_Input.php,
Code:
class MY_Input extends CI_Input {

}

etc.

#3
[eluser]brixxster[/eluser]
Thanks for the reply Nick, I have checked the filenames and it is following the guide guides you mention above. Here's the snippet of the "application/libraries/MY_Form_validation.php"


Code:
class MY_Form_validation extends CI_Form_validation {

    function __construct()
    {
        parent::CI_Form_validation();
    }
    
    function set_rules($field, $label = '', $rules = '')
    {
        if(count($_POST)===0 AND count($_FILES) > 0)//it will prevent the form_validation from working
        {
            //add a dummy $_POST
            $_POST['DUMMY_ITEM'] = '';
            parent::set_rules($field,$label,$rules);
            unset($_POST['DUMMY_ITEM']);
        }
        else
        {
            //we are safe just run as is
            parent::set_rules($field,$label,$rules);
        }    
    }
....

and I am calling it in my controller like this..
Code:
$this->load->library('my_form_validation');

It's strange... please help.

#4
[eluser]Nick_MyShuitings[/eluser]
Perhaps this snippet of the user guide:

Quote:To load your sub-class you'll use the standard syntax normally used. DO NOT include your prefix.

Have you tried just loading:

Code:
$this->load->library('form_validation');

Also, given that Codigniter supposedly doesn't care how you call/load the models or classes I personally tend to follow the same capitalization as the filename and class name when loading.

That's as much as I'll be able to check while here at work... but if its still not working when I get to my dev computer I'll run a quick test.

#5
[eluser]brixxster[/eluser]
Thanks Nick, I'm currently working on it also and seems like the server is caching the files that even I deleted the controller it still shows up on my browser.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.