mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Remove required from all admin add/edit form inputs
- Skip required-field validation for orientation/ap/finality/licence/jury in admin add+edit
This commit is contained in:
@@ -18,6 +18,7 @@ $withAutofocusFn = $withAutofocusFn ?? fn($field, $attrs = []) => $attrs;
|
||||
$allowedObjet = $allowedObjet ?? [];
|
||||
$formData = $formData ?? [];
|
||||
$synopsisExtra = $synopsisExtra ?? '';
|
||||
$adminMode = $adminMode ?? false;
|
||||
?>
|
||||
<fieldset>
|
||||
<legend>Informations du TFE</legend>
|
||||
@@ -30,7 +31,8 @@ $synopsisExtra = $synopsisExtra ?? '';
|
||||
<?php foreach ($allowedObjet as $objetVal): ?>
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="radio" name="objet" value="<?= htmlspecialchars($objetVal) ?>"
|
||||
<?= ($oldFn('objet') ?: $allowedObjet[0]) === $objetVal ? 'checked' : '' ?> required>
|
||||
<?= ($oldFn('objet') ?: $allowedObjet[0]) === $objetVal ? 'checked' : '' ?>
|
||||
<?= $adminMode ? '' : 'required' ?>>
|
||||
<?= htmlspecialchars(ucfirst($objetVal)) ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
@@ -42,7 +44,7 @@ $synopsisExtra = $synopsisExtra ?? '';
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$name = 'titre'; $label = 'Titre du TFE :'; $value = $oldFn('titre'); $required = true;
|
||||
$name = 'titre'; $label = 'Titre du TFE :'; $value = $oldFn('titre'); $required = !$adminMode;
|
||||
$attrs = $withAutofocusFn('titre');
|
||||
include APP_ROOT . '/templates/partials/form/text-field.php';
|
||||
?>
|
||||
@@ -51,7 +53,7 @@ $synopsisExtra = $synopsisExtra ?? '';
|
||||
include APP_ROOT . '/templates/partials/form/text-field.php';
|
||||
?>
|
||||
<?php
|
||||
$name = 'auteurice'; $label = 'Auteur·ice(s) :'; $value = $oldFn('auteurice'); $required = true;
|
||||
$name = 'auteurice'; $label = 'Auteur·ice(s) :'; $value = $oldFn('auteurice'); $required = !$adminMode;
|
||||
$attrs = $withAutofocusFn('auteurice', ['autocomplete' => 'name']);
|
||||
$hint = 'Séparez les auteur·ices par des virgules.';
|
||||
include APP_ROOT . '/templates/partials/form/text-field.php';
|
||||
@@ -64,9 +66,9 @@ $synopsisExtra = $synopsisExtra ?? '';
|
||||
?>
|
||||
|
||||
<div>
|
||||
<label for="synopsis">Synopsis : <span class="asterisk">*</span></label>
|
||||
<label for="synopsis">Synopsis :<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></label>
|
||||
<?= $synopsisExtra ?>
|
||||
<textarea id="synopsis" name="synopsis" rows="7" required
|
||||
<textarea id="synopsis" name="synopsis" rows="7" <?= $adminMode ? '' : 'required' ?>
|
||||
<?= ($withAutofocusFn('synopsis')['autofocus'] ?? false) ? 'autofocus' : '' ?>><?= $oldFn('synopsis') ?></textarea>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
Reference in New Issue
Block a user