summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlbeer <noreply@maennchen1.de>2026-09-25 17:05:27 +0200
committerjlbeer <noreply@maennchen1.de>2026-09-25 17:05:27 +0200
commitfc461e1afd3dcce2ddb39c0f3da5fd7cd342100a (patch)
tree5b9df483464ba28142a47bd3e3c49472ddf861dd
parentffe8dbf4d9e270d32effe2598d51cd45a43a4910 (diff)
- wenn Garan-Label nicht aktiv ist, hat garan_years das Speichern des Produkts verhindert
-rw-r--r--views/produkt/addedit_general.phtml11
1 files changed, 10 insertions, 1 deletions
diff --git a/views/produkt/addedit_general.phtml b/views/produkt/addedit_general.phtml
index dabfb6d..115d886 100644
--- a/views/produkt/addedit_general.phtml
+++ b/views/produkt/addedit_general.phtml
@@ -89,7 +89,7 @@
<?php echo wpsg_drawForm_Checkbox('garan', __('GARAN-Gewährleistungslabel', 'wpsg'), intval($this->view['data']['garan']??0) === 1, ['id' => 'wpsg_garan_checkbox']); ?>
<div id="wpsg_garan_layer" style="display:none;">
- <?php echo wpsg_drawForm_Input('garan_years', __('GARAN-Gewährleistungsjahre', 'wpsg'), $this->view['data']['garan_years']??'', ['type' => 'number', 'min' => 2]); ?>
+ <?php echo wpsg_drawForm_Input('garan_years', __('GARAN-Gewährleistungsjahre', 'wpsg'), ((intval($this->view['data']['garan_years']??0) > 0)?intval($this->view['data']['garan_years']):''), ['type' => 'number', 'min' => 2]); ?>
<?php echo wpsg_drawForm_Input('garan_brand', __('GARAN-Marke/Markenzeichen', 'wpsg'), $this->view['data']['garan_brand']??'', []); ?>
<?php echo wpsg_drawForm_Input('garan_model', __('GARAN-Modellnummer', 'wpsg'), $this->view['data']['garan_model']??'', []); ?>
</div>
@@ -97,12 +97,21 @@
const el_checkbox = document.getElementById('wpsg_garan_checkbox');
const el_layer = document.getElementById('wpsg_garan_layer');
+ const el_years = el_layer.querySelector('input[name="garan_years"]');
el_checkbox.addEventListener('change', () => {
if (el_checkbox.checked) el_layer.style.display = 'block';
else el_layer.style.display = 'none';
+ // Versteckte Felder dürfen die Browser-Validierung nicht blockieren
+ if (el_years) {
+
+ if (el_checkbox.checked) el_years.setAttribute('min', '2');
+ else el_years.removeAttribute('min');
+
+ }
+
});
el_checkbox.dispatchEvent(new Event('change'));