double07,

This article discusses exactly what you need -
http://bakery.cakephp.org/articles/view/using-the-ajax-helper-for-inplaceeditor-and-inplacecollectioneditor-fields
Pay close attention, when Paul goes over ajax_update.  That's the
action that will the posted form data.

-teh



On May 21, 9:52 pm, double07 <br...@bluenectar.com.au> wrote:
> Hi All,
>
> I'm currently working on a comments section of my site and I'm trying
> to allow the comments to be edited via an ajax edit-in-place field. I
> can't work out how the data is passed to the controller though and
> also how to access that data in the controller...
>
> In my controller I have:
>
> function admin_edit() {
>        $this->Comment->saveField('body', ???);
>        $this->set('comment', ??? );
>        $this->layout = 'ajax';
>
> }
>
> In my view I have:
> echo '<div id="Comment'. $comment['id'] . '">' . $comment['body'] . '</
> div>';
>                         echo $ajax->editor(
>                                 'Comment'.$comment['id'],
>                                 array(
>                                         'controller' => 'comments',
>                                         'action' => 'admin_edit',
>                                         $comment['id']
>                                 ),
>                                 array('okText' => 'Save', 'rows' => '4', 
> 'cols' => '72',
> 'highlightcolor' => '#d1eeff', 'highlightendcolor' => '#f4f4f4')
>                         );
> echo '</div>';
>
> In the submitted view I have:
> <?php echo $comment);?>
>
> I can't work out what I'm supposed to put where the question marks
> are. In my searching high and low for an answer I came across a
> similar post on these groups saying that the data is available in the
> controller via $this->params['formname']['field'] - so does this mean
> that I have to put the $ajax->editor inside a form? If not how do I
> know what the ajax form/field is named???
>
> Thanks,
>
> -Brett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to