fix: revert auto-submit — keep visible file input, remove capture only

This commit is contained in:
Stephan Kerkman 2026-05-30 21:30:44 +02:00
parent 0f53adc6a8
commit cbd4ba09aa

View file

@ -35,17 +35,12 @@
<form method="post" action="{% url 'upload_photo' plant.pk %}" enctype="multipart/form-data" <form method="post" action="{% url 'upload_photo' plant.pk %}" enctype="multipart/form-data"
hx-post="{% url 'upload_photo' plant.pk %}" hx-target="#photo-gallery" hx-swap="outerHTML" hx-post="{% url 'upload_photo' plant.pk %}" hx-target="#photo-gallery" hx-swap="outerHTML"
hx-encoding="multipart/form-data" hx-indicator="#photo-upload-spinner" hx-encoding="multipart/form-data" hx-indicator="#photo-upload-spinner">
id="photo-upload-form">
{% csrf_token %} {% csrf_token %}
<div class="d-flex gap-2 align-items-center flex-wrap">
<input type="file" name="image" accept="image/*" <input type="file" name="image" accept="image/*"
class="d-none" id="photo-file-input" class="form-control form-control-sm" style="max-width:220px;">
onchange="this.form.querySelector('#photo-upload-label').textContent = this.files[0]?.name ?? 'Add photo'; this.form.requestSubmit();"> <button type="submit" class="btn btn-sm btn-outline-secondary">Upload</button>
<div class="d-flex gap-2 align-items-center">
<label for="photo-file-input" id="photo-upload-label"
class="btn btn-sm btn-outline-secondary mb-0" style="cursor:pointer;">
Add photo
</label>
<span id="photo-upload-spinner" class="htmx-indicator text-muted small">Uploading…</span> <span id="photo-upload-spinner" class="htmx-indicator text-muted small">Uploading…</span>
</div> </div>
</form> </form>