I have two tables in my database "cars" and "car_types". "cars" means "car_types" to "car_type_id". For example, "car_types" has 2 fields "id" and "car_type". It also has 3 entries: "new", "used dealer", "used private". How can I show these 3 entries as a checkbox in my view.
I am trying to customize the output:
foreach ($car_types as $car_type)
{
$car_type_new[$car_type['CarType']['id']]=$car_type['CarType']['car_type'];
}
echo $this->Form->input('Car.car_type_id',array('div'=>false,'multiple'=>'checkbox','options'=>$car_type_new,'style'=>"margin-left:20px; padding:0;"));
I also want to remove the wrapper div around each checkbox.
Each flag is displayed by the form helper this way, even if the div => false parameter is set:
<input type="hidden" id="CarCarTypeId" value="" name="data[Car][car_type_id]">
<div class="checkbox"><input type="checkbox" id="CarCarTypeId1" value="1" name="data[Car][car_type_id][]"><label for="CarCarTypeId1">New</label></div>
<div class="checkbox"><input type="checkbox" id="CarCarTypeId2" value="2" name="data[Car][car_type_id][]"><label for="CarCarTypeId2">Used Dealer</label></div>
<div class="checkbox"><input type="checkbox" id="CarCarTypeId3" value="3" name="data[Car][car_type_id][]"><label for="CarCarTypeId3">Used Private
</label></div>
the div => false parameter removes only the div wrapped around the entire collection of flags, but not every flag.
, div, ? , , , .