Hello all,

I am implementing the jEditable plugin for jquery for inplace editing
of database fields.
I am working off of the instructions found here:
http://cakebaker.42dh.com/2008/02/24/edit-in-place-with-jquery-and-cakephp/

I should note that the field is, in fact, being updated in the
database but cakePHP returns an error where the new field should print
on the page.

cakePHP Error:
    Undefined variable: title [APP/views/projects/update_title.ctp,
line 1]

Action in my projects controller:
    function updateTitle() {
                if ($this->data) {
                        App::import('Core', 'sanitize');
                        $title = 
Sanitize::clean($this->data['Upload']['title']);

                        $this->Upload->id = $this->data['Upload']['id'];
                        $this->Upload->saveField('title', $title);
                        $this->set('title', $title);
                }
    }

Javascript:
    $('.edit').editable('/uploads/updateTitle', {
         id        : 'data[Upload][id]',
         name      : 'data[Upload][title]',
         type      : 'text',
                 indicator      : "<img src='../img/loadingAnimation.gif'>",
         cancel    : 'Cancel',
         submit    : 'Save',
         tooltip   : 'Click to edit the title'
    });

And finally the line of code in my view:
    <span class="edit" id="<?php echo $upload['id']; ?>"><?php echo
$upload['title']; ?></span>

Thanks for your help.

Also, another problem I found when I was working my way through
getting the fields to update was that when I add it to any model that
uses the Tags behavior found here: 
http://bakery.cakephp.org/articles/view/simple-tagging-behavior
it kills the associations with the Tag table and I have to reedit and
save the tags to add them again.

Thanks twice.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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