Welcome Guest, Not a member yet? Register   Sign In
Problem with input class
#1

[eluser]s.passiatore[/eluser]
Hi to all, I've an ajax request to a controller...

In the ajax request I've the ID form data field.

In the controller I call $this->input->post('id') btu I get this error:

PHP Fatal error: Call to a member function post() on a non-object

Where is the problem?
thanks a lot
Stefano
#2

[eluser]danmontgomery[/eluser]
Post code. Have you defined a constructor without calling the parent?
#3

[eluser]s.passiatore[/eluser]
Hi, this is my controller...
Thanks

Code:
class CommentRequestHandler extends BaseRequestHandler {
    
    private $data = null;
    
    public function execute() {
        $this->data = array("output" => $this->controller->CommentModel->getComment($this->input->post('id')));
    }
    
    public function getData() {
        return $this->data;
    }

    public function getView() {
        return "user/JSONOut";
    }
#4

[eluser]danmontgomery[/eluser]
and BaseRequestHandler is a controller? If that's the case, what is $this->controller?
#5

[eluser]s.passiatore[/eluser]
Hi, yes BaseRequestHandler is a controller and this is hte correct code:

Code:
class CommentRequestHandler extends BaseRequestHandler {
    
    private $data = null;
    
    public function execute() {
    $this->controller->load->model('user/CommentModel');

        $this->data = array("output" => $this->controller->CommentModel->getComment($this->input->post('id')));
    }
    
    public function getData() {
        return $this->data;
    }

    public function getView() {
        return "user/JSONOut";
    }

Thanks!
Stefano
#6

[eluser]s.passiatore[/eluser]
Anyone?
Thanks a lot
Stefano
#7

[eluser]danmontgomery[/eluser]
If CommentRequestHandler is a controller, why are you calling $this->controller?

Can you post BaseRequestHandler?




Theme © iAndrew 2016 - Forum software by © MyBB