Welcome Guest, Not a member yet? Register   Sign In
form_validation and the template parser
#1

[eluser]JCianflone[/eluser]
Hi everyone,
Does anyone know of any issues/conflicts with the template parser and using the validation library? I know the validation library is working correctly, but it's not displaying the errors. Every example is using $this->load->view(); but I am using the parser not the view. So, that may be the issue. I haven't seen anything on Google or in the forums.

Thanks

FYI: I am using 1.7.1
#2

[eluser]JCianflone[/eluser]
Ok, something is really wrong, but I don't know what here is my function

Code:
public function contact() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('txt_name', 'Name', 'required');
        
        if ($this->form_validation->run() == FALSE) {
            
            $this->page['meta_title'] = 'Contact';
            $this->page['signature'] = 'contact';
            
            $this->page['header'] = 'Contact';        
            
            $this->templates->internal('site/contact/main', $this->page);    
        }
        else {
            redirect ('contact/thanks');
            
        }

when I try to load the library IN this function, the only place it's being used, I get an error. When I move it out to the constructor, no error. It still doesn't work, but I don't get an error. Am I doing something wrong here?

form and url are being loaded in the autoload file
#3

[eluser]TheFuzzy0ne[/eluser]
What error are you getting?
#4

[eluser]JCianflone[/eluser]
My error message...
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Website::$form_validation

Filename: controllers/website.php

Line Number: 43

Fatal error: Call to a member function set_rules() on a non-object in ... on line 43
#5

[eluser]TheFuzzy0ne[/eluser]
What's at line 43? Does your controller extend the Controller class, and does your constructor (if you have one) call the parent class constructor? I'd expect to see that error if I hadn't loaded the form_validation class, which I can see you have done.
#6

[eluser]JCianflone[/eluser]
My constructor is calling the parent class constructor, and line 43 is this line:
Code:
$this->form_validation->set_rules('txt_name', 'Name', 'required');

...that's the really confusing part to me here. I'd expect this error IF my validation class wasn't initialized, but it is, as far as I can tell.
#7

[eluser]JCianflone[/eluser]
ah, I just found this thread:

http://ellislab.com/forums/viewthread/110848/

Apparently, there may be an issue in PHP 5.2.6 under OSX.

I'll have to try updating this tonight and see if that solves my issues.
#8

[eluser]JCianflone[/eluser]
well...that didn't work... Sad
#9

[eluser]TheFuzzy0ne[/eluser]
What happens when you load the library in the constructor, or set it to load automatically. I know that loading it automatically is not a permanent solution, but it might help us figure out what's going on.




Theme © iAndrew 2016 - Forum software by © MyBB