I am trying to save the fields in a form using a function rather than
1 set for each field. I was trying to get the $data and $fieldname
idea going where based on the field and data it would update the db
correctly.
This is the code inside the controller:
function update($data, $fieldName) {
if ($this->data) {
App::import('Core', 'sanitize');
$fieldName = Sanitize::clean($this->data
['User'][$fieldName]);
$this->User->id = $this->data['User']['id'];
$this->User->saveField($data, $fieldName);
$this->set($data, $fieldName);
}
}
the javascript looks like this
$(function() {
$('.click').editable('/users/update', {
id : 'data[User][id]',
name : '$fieldName',
indicator : "<img src='../img/saving.gif'>",
tooltip : "Click to edit...",
style : "inherit"
});
});
The update.ctp view is:
<?php echo $data;?>
Can any one tell me what i am doing wrong or point me in the right
direction?
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
-~----------~----~----~----~------~----~------~--~---