dimanche 18 janvier 2015

dynamic updated checkboxes from 1 table

Hello i am new to cakephp and running into a little problem.


I have 2 mysql tables accesses and systems:



CREATE TABLE IF NOT EXISTS `iam_db`.`accesses` (
`id` INT NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(255) NOT NULL,
`last_name` VARCHAR(255) NOT NULL,
`systems_id` INT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`systems_id`))

CREATE TABLE IF NOT EXISTS `iam_db`.`systems` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`))


I have baked my models, controllers and views, then filled the systems table with static input.


Now my problem. If i create a new access i just get an dropdown list for systems. Even if i edit the Accesses/add view with static options:



echo $this->Form->input('systems_id', array(
'type' => 'select',
'multiple' => 'checkbox',
'options' => array(
1 => 'test1',
2 => 'test2',
)
)
);


no checkboxes appear...? Is there anything to add in the accesses model or controller ?


I've read the cookbook section for the FormHelper->Checkbox but didnt find the answer, to get all my static systems as checkboxes...





Aucun commentaire:

Enregistrer un commentaire