Search code examples
phpjquerycakephpjeditable

Problem integrating jeditable in cakephp


I have integrated jquery jeditable in my project.

$(function() {
  $(".editable_textarea").editable("/articles/edit/", { 
      indicator : "<img src='img/indicator.gif'>",
      type   : 'textarea',
      select : true,
      submit : 'OK',
      cancel : 'cancel',
      cssclass : "editable",
      method : 'POST',
  });
});

Now when I click on the div.editable_textarea you see textarea with ok button. Now when make changes and click on OK. In my controller action /articles/edit, I am simple print $this->data.

It prints Array()(empty array).

No data is sent to controller. I also tried $this->params['url'].

It prints Array('URL' => '/articles/edit').

I appreciate any help.

Thanks.


Solution

  • You did not named it

    $(function() {
      $(".editable_textarea").editable("/articles/edit/", { 
          indicator : "<img src='img/indicator.gif'>",
          type   : 'textarea',
          name   : 'data[Articles][desc]',
          select : true,
          submit : 'OK',
          cancel : 'cancel',
          cssclass : "editable",
          method : 'POST',
      });
    });
    

    and you can access this in your controller like

    echo $this->data['Articles']['desc'];
    

    You can go with this for your more info