I have a form drop down box within pagination.
When the user selects a task from the drop down i want it to update
the database table to show the current status
The problems i am having is:
1. the client id is not populating in the form
2. it changes all of the select drop down boxes when it should only
change the one i changed
3. the most important problem it doesn't save the results
view
echo $this->Form-
>create('Client',array('controller'=>'clients','action'=>'edittask',
$client['Client']['id']));
echo $this->Form->input('id');
echo $this->Form->input('task_id');
echo $this->Js->submit('Save', array('update' => '#content'));
controller
function edittask($id = null) {
if ($this->RequestHandler->isAjax()) {
Configure::write('debug', 0);
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid client', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Client->save($this->data)) {
$this->Session->setFlash(__('The client has
been saved', true));
} else {
$this->Session->setFlash(__('The client could
not be saved.
Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Client->read(null, $id);
}
$users = $this->Client->User->find('list',
array('fields' =>
array('User.id', 'User.username')));
$tasks = $this->Client->Task->find('list', array('fields' =>
array('Task.id', 'Task.job')));
$agencies = $this->Client->Agency->find('list');
$this->set(compact('users', 'tasks', 'agencies'));
}
}
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php