Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle data-attributes #182

Open
LeJxrxm opened this issue Feb 14, 2024 · 0 comments
Open

Handle data-attributes #182

LeJxrxm opened this issue Feb 14, 2024 · 0 comments

Comments

@LeJxrxm
Copy link

LeJxrxm commented Feb 14, 2024

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>&nbsp;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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant