I am building a task manager application and among other I have these tables:
TaskTypes : [id, name, instructions]
TaskElements : [id, name, description, task_type_id, element_category_id]
ElementCategories : [id, name]
In the TaskTypes
view.cpt
I want to create a button which will open a new screen where the user can select an Element Category
from a drop down menu and then will see a table with all the TaskElements
that belong to this Element Category
. Each row (Task Element) will have a checkbox, so the user can select Task Elements
and then with a Submit
button the selected Task Elements
will be duplicated with the task_type_id
filled from the TaskTypes view.cpt
.
Because I am fairly new to cakephp I have these questions:
How I can write the code to update the table based on the dropdown selection?
I have created these new files:
addelement\index.ctp
and AddElementController.php
:
AddElementController.php:
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* AddElement Controller
*/
class AddElementController extends AppController
{
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$elementCategories = TableRegistry::get('ElementCategories')->find('list', ['limit' => 200]);
$this->set(compact('elementCategories'));
}
}