OK got this working - not sure its the *best* way though
In your view:
<?php echo $ajax->editor('edit-address','update?name=address&id='.
$participant['Participant']['id']); ?>
i.e. use the GET param to pass through an id and the field name
In your controller:
$this->autoRender = false;
if(!empty($this->params['form'])) {
$value = $this->params['form']['value'];
$this->Participant->id = $_GET['id'];
$name = $_GET['name'];
if($this->Participant->saveField($name,
$value)){
echo $value;
} else {
echo "bad ass"; // not sure how to
debug yet!
}
exit;
}
hth
will
On Jul 31, 9:08 am, willard <[EMAIL PROTECTED]> wrote:
> Apologies for the slightly newbie email - Im finding my way around the
> cake API a little tricky
>
> Basically I'm trying to do inplace editing. Key elements (if you are
> coming across this post looking as to how to do it) are:
> 1.
> <?php print $html->charsetTag('UTF-8'); ?>
> <?php print $javascript->link('prototype'); ?>
> <?php print $javascript->link('scriptaculous.js?
> load=effects,controls'); ?> in the default layout
> 2. <span id="edit-parent1_name"><?php echo $participant['Participant']
> ['parent1_name']?></span><?php echo $ajax->editor('edit-
> parent1_name','update/'); ?> in your view.
>
> which provides a simple onmouseover -> text box for the text to be
> edited.
> However I cant debug what the heck cake is receiving and thus I cant
> try and save anything.
>
> In my controller:
> function update(){
> // $this->Participant->save($this->data['Participant']);
> $this->render('done', 'ajax');
> }
>
> - How do I get the Participant model to save just one field - not the
> whole model? Im guessing something like
> $this->Participant->save($this->data['Participant']
> ['parent1_name''],'parent1_name'')
> ?????
>
> Any ideas???
> Anyone know of a demo of the inplace editor and cake being used at
> all?
>
> Thanks!
>
> Will
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---