backoffice: separate launcher Set / Remove forms (nested form bug)

The previous markup had a <form action=remove_launcher> nested inside a
<form action=set_launcher>. HTML doesn't allow nested forms — browsers
flatten the structure unpredictably, and clicking the inner "Définir"
submit could end up posting the outer (or vice versa), causing the
section to be removed when the user actually wanted to set it.

Two sibling forms now, with a 12px gap between them. Same UX.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-02 10:42:31 +02:00
parent 197b07966c
commit 5f1057d118

View File

@@ -279,18 +279,18 @@ Layout::header('Versions', 'versions');
value="<?= htmlspecialchars($launcher['minRequired'] ?? '0.5.0') ?>" pattern="\d+\.\d+\.\d+"> value="<?= htmlspecialchars($launcher['minRequired'] ?? '0.5.0') ?>" pattern="\d+\.\d+\.\d+">
</div> </div>
</div> </div>
<div class="toolbar"> <button class="btn btn-success" type="submit">Définir</button>
<button class="btn btn-success" type="submit">Définir</button>
<?php if ($launcher): ?>
<form method="post" style="display:inline" onsubmit="return confirm('Retirer la section launcher du manifest ? L\'auto-update sera désactivé.')">
<?= Layout::csrfField() ?>
<input type="hidden" name="action" value="remove_launcher">
<button class="btn btn-danger" type="submit">Retirer la section</button>
</form>
<?php endif; ?>
</div>
</form> </form>
<?php if ($launcher): ?>
<form method="post" style="margin-top: 12px;"
onsubmit="return confirm('Retirer la section launcher du manifest ? L\'auto-update sera désactivé.')">
<?= Layout::csrfField() ?>
<input type="hidden" name="action" value="remove_launcher">
<button class="btn btn-danger" type="submit">Retirer la section launcher</button>
</form>
<?php endif; ?>
<h3 style="margin-top: 18px; font-size: 13px; color: var(--text-secondary); text-transform: uppercase;">Workflow</h3> <h3 style="margin-top: 18px; font-size: 13px; color: var(--text-secondary); text-transform: uppercase;">Workflow</h3>
<ol class="muted"> <ol class="muted">
<li>Définis la version ci-dessus (ex : <code>0.6.0</code>).</li> <li>Définis la version ci-dessus (ex : <code>0.6.0</code>).</li>