Browse code

Fix multiple ids with same name

Benjamin Roth authored on26/08/2025 14:40:49
Showing2 changed files
... ...
@@ -52,8 +52,8 @@
52 52
                 <div class="grid-md u-gap-2">
53 53
                     <div class="grid-c-6 mb-2 mb-0-md">
54 54
                         <fieldset>
55
-                            <label for="res-behaeltereinheit"><strong>Anlieferungsart<sup class="text-danger">*</sup></strong></label>
56
-                            <select id="res-behaeltereinheit" name="unit" hx-get="/_ajax/vr_wa/v1/slot?do=availableBookingUnitAmount&id={{ id }}" hx-target="#wa-booking-{{ id }} #res-behaelter" hx-trigger="change, load">
55
+                            <label for="slot-{{ id }}-res-behaeltereinheit"><strong>Anlieferungsart<sup class="text-danger">*</sup></strong></label>
56
+                            <select id="slot-{{ id }}-res-behaeltereinheit" name="unit" hx-get="/_ajax/vr_wa/v1/slot?do=availableBookingUnitAmount&id={{ id }}" hx-target="#wa-booking-{{ id }} #res-behaelter" hx-trigger="change, load">
57 57
                                 {% if not buchen.disable_base_unit %}
58 58
                                     <option value=""{% if buchen.default_unit == '' %} selected{% endif %}>{{ 'tl_vr_wa_units.containers.0'|trans([], 'contao_tl_vr_wa_units') }}</option>
59 59
                                 {% endif %}
... ...
@@ -65,8 +65,8 @@
65 65
                     </div>
66 66
                     <div class="grid-c-6 mb-2 mb-0-md">
67 67
                         <fieldset>
68
-                            <label for="res-behaelter"><strong>Menge (in Bottichen)<sup class="text-danger">*</sup></strong></label>
69
-                            <select id="res-behaelter" name="behaelter" required>
68
+                            <label for="slot-{{ id }}-res-behaelter"><strong>Menge (in Bottichen)<sup class="text-danger">*</sup></strong></label>
69
+                            <select id="slot-{{ id }}-res-behaelter" name="behaelter" required>
70 70
                                 <option value="">-</option>
71 71
                                 {% for option in buchen.behaelter %}
72 72
                                     {% if option > buchen.default %}
... ...
@@ -90,15 +90,15 @@
90 90
                             {% for attribute in group.attributes %}
91 91
                                 <div class="attribute-item">
92 92
                                     {% if group.type == 'text' %}
93
-                                        <label for="b_attribute_{{ attribute.id }}"><strong>{{ attribute.title }}</strong></label>
94
-                                        <input type="text" id="b_attribute_{{ attribute.id }}" name="attribute_{{ attribute.id }}" class="form-control" value="{{ attribute.value }}">
93
+                                        <label for="slot-{{ id }}-b_attribute_{{ attribute.id }}"><strong>{{ attribute.title }}</strong></label>
94
+                                        <input type="text" id="slot-{{ id }}-b_attribute_{{ attribute.id }}" name="attribute_{{ attribute.id }}" class="form-control" value="{{ attribute.value }}">
95 95
                                         {% if attribute.description %}
96 96
                                             <div class="fieldset-description"><span class="info">{{ attribute.description }}</span></div>
97 97
                                         {% endif %}
98 98
                                     {% elseif group.type == 'option' %}
99 99
                                         <div class="checkbox form-ext-control form-ext-{{ group.multiple ? 'checkbox' : 'radio' }}">
100
-                                            <input class="form-ext-input" type="{{ group.multiple ? 'checkbox' : 'radio' }}" id="b_attribute_{{ attribute.id }}" name="{{ group.multiple ? 'attribute_'~attribute.id : 'group_'~group.id }}" value="{{ attribute.id }}" {% if attribute.id == attribute.value %}checked{% endif %}>
101
-                                            <label class="form-ext-label" for="b_attribute_{{ attribute.id }}">{{ attribute.title }}</label>
100
+                                            <input class="form-ext-input" type="{{ group.multiple ? 'checkbox' : 'radio' }}" id="slot-{{ id }}-b_attribute_{{ attribute.id }}" name="{{ group.multiple ? 'attribute_'~attribute.id : 'group_'~group.id }}" value="{{ attribute.id }}" {% if attribute.id == attribute.value %}checked{% endif %}>
101
+                                            <label class="form-ext-label" for="slot-{{ id }}-b_attribute_{{ attribute.id }}">{{ attribute.title }}</label>
102 102
                                         </div>
103 103
                                     {% endif %}
104 104
                                 </div>
... ...
@@ -108,8 +108,8 @@
108 108
                 {% endif %}
109 109
 
110 110
                 <fieldset>
111
-                    <label for="res-annotation"><strong>Anmerkung</strong></label>
112
-                    <textarea id="res-annotation" name="annotation">{{ buchung.annotation }}</textarea>
111
+                    <label for="slot-{{ id }}-res-annotation"><strong>Anmerkung</strong></label>
112
+                    <textarea id="slot-{{ id }}-res-annotation" name="annotation">{{ buchung.annotation }}</textarea>
113 113
                 </fieldset>
114 114
                 {% if file is defined %}
115 115
                     <fieldset>
... ...
@@ -117,13 +117,13 @@
117 117
                         <div class="u-flex u-items-center u-gap-1"><a href="{{ file.link }}">{{ file.name }}</a> <a href="javascript:;" hx-get="/_ajax/vr_wa/v1/slot?do=booking&id={{ id }}&modal=false&deleteFile=true" hx-target="closest .frame" hx-swap="outerHTML" class="tag tag__close-btn tag--danger tag--xs"></a></div>
118 118
                     </fieldset>
119 119
                     <fieldset>
120
-                        <label for="res-upload"><strong>Datei überschreiben</strong></label>
121
-                        <input type="file" id="res-upload" name="upload">
120
+                        <label for="slot-{{ id }}-res-upload"><strong>Datei überschreiben</strong></label>
121
+                        <input type="file" id="slot-{{ id }}-res-upload" name="upload">
122 122
                     </fieldset>
123 123
                 {% else %}
124 124
                     <fieldset>
125
-                        <label for="res-upload"><strong>Datei hochladen</strong></label>
126
-                        <input type="file" id="res-upload" name="upload">
125
+                        <label for="slot-{{ id }}-res-upload"><strong>Datei hochladen</strong></label>
126
+                        <input type="file" id="slot-{{ id }}-res-upload" name="upload">
127 127
                     </fieldset>
128 128
                 {% endif %}
129 129
                 <fieldset>
... ...
@@ -86,8 +86,8 @@
86 86
                         <div class="grid-md u-gap-2">
87 87
                             <div class="grid-c-6 mb-2 mb-0-md">
88 88
                                 <fieldset>
89
-                                    <label for="res-behaeltereinheit"><strong>Anlieferungsart<sup class="text-danger">*</sup></strong></label>
90
-                                    <select id="res-behaeltereinheit" name="unit" hx-get="/_ajax/vr_wa/v1/slot?do=availableUnitAmount&id={{ id }}" hx-target="#wa-slot-{{ id }} #res-behaelter" hx-trigger="change, load">
89
+                                    <label for="slot-{{ id }}-res-behaeltereinheit"><strong>Anlieferungsart<sup class="text-danger">*</sup></strong></label>
90
+                                    <select id="slot-{{ id }}-res-behaeltereinheit" name="unit" hx-get="/_ajax/vr_wa/v1/slot?do=availableUnitAmount&id={{ id }}" hx-target="#wa-slot-{{ id }} #res-behaelter" hx-trigger="change, load">
91 91
                                         {% if not buchen.disable_base_unit %}
92 92
                                             <option value=""{% if buchen.default_unit == '' %} selected{% endif %}>{{ 'tl_vr_wa_units.containers.0'|trans([], 'contao_tl_vr_wa_units') }}</option>
93 93
                                         {% endif %}
... ...
@@ -99,8 +99,8 @@
99 99
                             </div>
100 100
                             <div class="grid-c-6 mb-2 mb-0-md">
101 101
                                 <fieldset>
102
-                                    <label for="res-behaelter"><strong>Menge (in Bottichen)<sup class="text-danger">*</sup></strong></label>
103
-                                    <select id="res-behaelter" name="behaelter" required>
102
+                                    <label for="slot-{{ id }}-res-behaelter"><strong>Menge (in Bottichen)<sup class="text-danger">*</sup></strong></label>
103
+                                    <select id="slot-{{ id }}-res-behaelter" name="behaelter" required>
104 104
                                         <option value="">-</option>
105 105
                                         {% for option in buchen.behaelter %}
106 106
                                             {% if option > slot.behaelterAvailable %}
... ...
@@ -125,14 +125,14 @@
125 125
                                         <div class="attribute-item">
126 126
                                             {% if group.type == 'text' %}
127 127
                                                 <label for="attribute_{{ attribute.id }}"><strong>{{ attribute.title }}</strong></label>
128
-                                                <input type="text" id="attribute_{{ attribute.id }}" name="attribute_{{ attribute.id }}" class="form-control">
128
+                                                <input type="text" id="slot-{{ id }}-attribute_{{ attribute.id }}" name="attribute_{{ attribute.id }}" class="form-control">
129 129
                                                 {% if attribute.description %}
130 130
                                                     <div class="fieldset-description"><span class="info">{{ attribute.description }}</span></div>
131 131
                                                 {% endif %}
132 132
                                             {% elseif group.type == 'option' %}
133 133
                                                 <div class="checkbox form-ext-control form-ext-{{ group.multiple ? 'checkbox' : 'radio' }}">
134
-                                                    <input class="form-ext-input" type="{{ group.multiple ? 'checkbox' : 'radio' }}" id="attribute_{{ attribute.id }}" name="{{ group.multiple ? 'attribute_'~attribute.id : 'group_'~group.id }}" value="{{ attribute.id }}">
135
-                                                    <label class="form-ext-label" for="attribute_{{ attribute.id }}">{{ attribute.title }}</label>
134
+                                                    <input class="form-ext-input" type="{{ group.multiple ? 'checkbox' : 'radio' }}" id="slot-{{ id }}-attribute_{{ attribute.id }}" name="{{ group.multiple ? 'attribute_'~attribute.id : 'group_'~group.id }}" value="{{ attribute.id }}">
135
+                                                    <label class="form-ext-label" for="slot-{{ id }}-attribute_{{ attribute.id }}">{{ attribute.title }}</label>
136 136
                                                 </div>
137 137
                                             {% endif %}
138 138
                                         </div>
... ...
@@ -142,12 +142,12 @@
142 142
                         {% endif %}
143 143
 
144 144
                         <fieldset>
145
-                            <label for="res-annotation"><strong>Anmerkung</strong></label>
146
-                            <textarea id="res-annotation" name="annotation"></textarea>
145
+                            <label for="slot-{{ id }}-res-annotation"><strong>Anmerkung</strong></label>
146
+                            <textarea id="slot-{{ id }}-res-annotation" name="annotation"></textarea>
147 147
                         </fieldset>
148 148
                         <fieldset>
149
-                            <label for="res-upload"><strong>Dateianhang</strong></label>
150
-                            <input type="file" id="res-upload" name="upload">
149
+                            <label for="slot-{{ id }}-res-upload"><strong>Dateianhang</strong></label>
150
+                            <input type="file" id="slot-{{ id }}-res-upload" name="upload">
151 151
                         </fieldset>
152 152
                         <fieldset>
153 153
                             <button type="submit">Reservieren</button>