I have something like this in my controller:

        /**
         * Saves the title with inline edit form
         *
         */
        public function admin_saveTitle()
        {
                // Check if the form has been submitted
                if (!empty($this->data)) {
                        // Check if article has been saved
                        if ($this->Article->save($this->data)) {
                                $this->set('data',  
$this->data['Article']['title']);
                        }
                }

                // Use ajax layout
                $this->layout = "ajax";
        }


And in my view:

    <?php foreach ($articles as $row => $article): ?>
    <tr <?php e(($row%2)?'class="altrow"':'') ?>>
        <td><?php echo $article['Article']['id']; ?></td>
        <td>
                <?php echo '<p id="title'.$article['Article']['id'] .  '">' .
$article['Article']['title'] . '</p>';?>
                 <script type="text/javascript">new
Ajax.InPlaceEditor('title<?php echo $article['Article']['id']; ?>',
                                                                                
                                                '<?php echo 
$this->webroot;?>admin/articles/
saveTitle',
                                                                                
                                                {okButton:false,
                                                                                
                                                        cancelLink:false,
                                                                                
                                                        submitOnBlur:true,
                                                                                
                                                        
highlightcolor:"#afcbd2",
                                                                                
                                                        callback: 
function(form, value) {return
'data[Article][title]=' + escape(value) + '&data[Article][id]=<?php
echo $article['Article']['id']; ?>'},
                                                                                
                                                        
ajaxOptions:{asynchronous:true,
evalScripts:true}});
                 </script>
        </td>
</tr>



On Aug 20, 9:19 am, Wimg <[EMAIL PROTECTED]> wrote:
> who knows how to do this or have any examples ? thx a lot!!!!!!!!!!!!!
> ~~~~~~~~~~~~~


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to