jquery) but it looks to me like your validation rules may be the
problem. The last param to saveField is true, thus triggering
validation. Check the model's validationErrors:
Debugger::log($this->PhdUser->validationErrors);
$this->set('error', true);
On Sat, Jan 31, 2009 at 4:05 PM, Al <al.scheuring@gmail.com> wrote:
>
> Hello All,
> I have two models PhdUser and PhdApplication.
> I'm trying to update information in PhdApplication using the following
> controller. (note: this works fine with data in PhdUser, and their
> linked correctly)
>
> function ajaxupdate($userID = null,$sub) {
>
> //Step 1. Update the value in the database
> $value = $this->params['form']['value']; //new value to save
> $this->PhdUser->id = $userID;
> if (!$this->PhdUser->saveField($sub, $value,true)) { // Update the
> field
> $this->set('error', true);
> }
>
> //Step 2. Set the view variable and render the view.
> $this->set('value',$value);
> $this->beforeRender();
> $this->layout = 'ajax';
> }
>
> And I'm using this as the editor:
>
> <?php
> echo $ajax->editor(
> 'divSubmitted',
> array(
> 'controller' => 'PhdUsers',
> 'action' => 'ajaxupdate',
> $phd_users['PhdUser']['userID'],
> '/submitted'
> ),
> array('collection' => array(array('no','no'), array('yes','yes'))));
>
> However I'm not getting it to save to PhdApplication.
>
> Is there something obvious I'm missing? Do I need to put an ajaxupdate
> function in each controller?
>
> thanks so much for taking the time to look this over (if you've gotten
> this far)
> >
>
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment