How do you go about setting up validation on Ajax.InPlaceEditor?
I have the editor working correctly but I cant seem to find anything
related to validating before saving the the data from the editor.
controller:
function ajax_update($id, $sub)
{
$value = $this->params['form']['value'];
$this->User->id = $id;
if (!$this->User->saveField($sub, $value, true)) {
$this->set('error', true);
}
$user= $this->User->read(array($sub), $id);
if (substr($sub, -3) == '_id') {
$new_sub = substr($sub, 0, strlen($sub) - 3);
$model_name = Inflector::camelize($new_sub);
if (!empty($this->$model_name->display_field)) {
$display_field = $this->$model_name->display_field;
} else {
$display_field = 'name';
}
$value = $this->$model_name->field($display_field, array
('id' => $value));
}
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---