I can't manage to find this on the web so I guess this might be a feature implementation:
I have a form which has items like so
<?php // Inside a repeater item // ?>
<img id="form-repeater-<?= $i ?>-1-preview" src="<?= $bloc->image ?? '#' ?>" alt="" class="d-block mx-auto img-fluid w-75" style="max-height: 340px; object-fit: contain">
<?= $this->Form->control('uploaded_file', ['class' => 'd-none preview', 'data-target' => '#form-repeater-' . $i . '-1-preview', 'type' => 'file', 'id' => 'form-repeater-' . $i . '-3-input', 'label' => false,]) ?>
<label for="form-repeater-<?= $i ?>-3-input" class="btn btn-outline-primary mt-1 w-100">
<i class="ti ti-upload"></i> Choisir l'image du header
</label>
What the code is supposed to do is show the user's file when it's changed
The img tag will show the img, the php call will create the input, $i is part of the loop, the label is just a button that will toggle the file explorer.
Everything is working like a charm, but the properties like "form-repeater-<?= $i ?>-1-preview" won't be handled by the lib.
Could be a nice feature to implement.
I can't manage to find this on the web so I guess this might be a feature implementation:
I have a form which has items like so
What the code is supposed to do is show the user's file when it's changed
The
imgtag will show the img, the php call will create the input,$iis part of the loop, thelabelis just a button that will toggle the file explorer.Everything is working like a charm, but the properties like
"form-repeater-<?= $i ?>-1-preview"won't be handled by the lib.Could be a nice feature to implement.