hello World, i read the forum about image radio buttons but not able to get the Form Control into the Form
originally the Add.ctp for this item is meant for Type=>Select
<?php echo $this->Form->control('product_image_id', array('label' => false, 'div' =>
false,
'class' => 'form-control', 'type' => 'select', 'empty' => 'Choose Image')); ?>
in the type select, the name of the images only shows out. not the images.
Thanks to Zuluru and MarekDM the label and id for the html has no issues. this set of codes makes the radio button with images work well,…
<?php foreach ($product['product_images'] as $productImg) : ?>
<div class="container parent">
<div class="row">
<div class='col text-center'>
<input type="radio" class="d-none imgbgchk" value="" name="imgbackground" id="<?=
$productImg->id ?>">
<label for="<?= $productImg->id ?>">
<?php
echo $this->Html->image($imgPath, ['width' => '100']);
?>
<div class="tick_container">
<div class="tick"><i class="fa fa-check"></i></div>
</div>
</label>
</div>
</div>
</div>
<?php endforeach; ?>
but not for this set when i seriously want to put the Form Control into the code for the add.ctp
<?php foreach ($product['product_images'] as $productImg) : ?>
<div class="container parent">
<div class="row">
<div class='col text-center'>
<?php echo $this->Form->control('product_image_id', ['type' => 'radio', 'escape' =>
false, 'class' => 'form-control', 'id' =>$productImg->id, 'name'=>'imgbackground' ]); ?
>
<label for="<?= $productImg->id ?>">
<?php
echo $this->Html->image($imgPath, ['width' => '100']);
?>
<div class="tick_container">
<div class="tick"><i class="fa fa-check"></i></div>
</div>
</label>
</div>
</div>
</div>
<?php endforeach; ?>
can anyone help to advise where i went disaligned?
thanks