Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<div class="tw:p-6 tw:max-w-7xl tw:mx-auto tw:space-y-8">
<div class="callout">
<p class="tw:mb-1 tw:text-sm tw:font-mono">
<strong>FIELD GROUP REPEAT:</strong> "Add another" repeating group of related form fields<br>
<strong>COMPOSES:</strong> <fieldset>/<legend> | .form-control / .form-select / .form-label / .form-text | .btn-tertiary | .btn-sm .btn-danger / .btn-tertiary
</p>
<p class="tw:mb-0 tw:text-sm">
Use wherever an applicant repeats the same small set of fields for multiple people or
items — e.g. one fieldset per child on a multi-child application. Each item is numbered
("Child 1", "Child 2"…) and can be removed down to a minimum of 1. Removing an item with
unsaved changes asks for confirmation inline first; removing a clean (untouched) item
removes it immediately. <code>field_group_repeat_controller.js</code> owns cloning,
renumbering, the dirty check, and screen-reader announcements.
</p>
</div>
<div class="tw:border-t tw:pt-6">
<h2 class="h4 tw:mb-4">Add another child — default</h2>
<div class="callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Starts at 1 item, max 4.</strong> Click <em>Add another child</em> to append a
new fieldset — legends renumber and every field's <code>name</code>/<code>id</code>/<code>for</code>
stays uniquely indexed. Fill in a field then click a <em>Remove</em> button: because the
item is now dirty, an inline confirm row replaces the trigger (Escape or Cancel backs
out). An untouched item removes immediately, no confirm. With only 1 item left, its
Remove button disables — at least one child is required. Add a 4th item and the
<em>Add another child</em> button disables at the max.
</p>
</div>
<div data-controller="field-group-repeat"
data-field-group-repeat-max-value="4"
data-field-group-repeat-label-value="Child"
id="field-group-repeat-children">
<div class="field-group-repeat" data-field-group-repeat-target="container">
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="1">
<legend class="tw:sr-only">Child 1</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 1</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 1 — at least one child is required" disabled
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-1-name">Child's full name</label>
<input type="text" class="form-control" id="child-1-name" name="children[1][name]"
aria-describedby="child-1-name-help">
<p class="form-text" id="child-1-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-1-dob">Date of birth</label>
<input type="date" class="form-control" id="child-1-dob" name="children[1][dob]">
</div>
<div>
<label class="form-label" for="child-1-year">School year</label>
<select class="form-select" id="child-1-year" name="children[1][year]">
<option value="">Select year</option>
<option value="reception">Reception</option>
<option value="year-1">Year 1</option>
<option value="year-2">Year 2</option>
<option value="year-3">Year 3</option>
<option value="year-4">Year 4</option>
<option value="year-5">Year 5</option>
<option value="year-6">Year 6</option>
<option value="year-7">Year 7</option>
<option value="year-8">Year 8</option>
<option value="year-9">Year 9</option>
<option value="year-10">Year 10</option>
<option value="year-11">Year 11</option>
</select>
</div>
</fieldset>
</div>
<button type="button" class="btn btn-tertiary field-group-repeat-add" data-field-group-repeat-target="add"
data-action="click->field-group-repeat#add">
<i class="fa-regular fa-plus" aria-hidden="true"></i>
Add another child
</button>
<p class="form-text" data-field-group-repeat-target="maxHint" hidden>Maximum of 4 children reached.</p>
<span class="tw:sr-only" aria-live="polite" data-field-group-repeat-target="status"></span>
<template data-field-group-repeat-target="template">
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item">
<legend class="tw:sr-only">Child __INDEX__</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child __INDEX__</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child __INDEX__"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-__INDEX__-name">Child's full name</label>
<input type="text" class="form-control" id="child-__INDEX__-name" name="children[__INDEX__][name]"
aria-describedby="child-__INDEX__-name-help">
<p class="form-text" id="child-__INDEX__-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-__INDEX__-dob">Date of birth</label>
<input type="date" class="form-control" id="child-__INDEX__-dob" name="children[__INDEX__][dob]">
</div>
<div>
<label class="form-label" for="child-__INDEX__-year">School year</label>
<select class="form-select" id="child-__INDEX__-year" name="children[__INDEX__][year]">
<option value="">Select year</option>
<option value="reception">Reception</option>
<option value="year-1">Year 1</option>
<option value="year-2">Year 2</option>
<option value="year-3">Year 3</option>
<option value="year-4">Year 4</option>
<option value="year-5">Year 5</option>
<option value="year-6">Year 6</option>
<option value="year-7">Year 7</option>
<option value="year-8">Year 8</option>
<option value="year-9">Year 9</option>
<option value="year-10">Year 10</option>
<option value="year-11">Year 11</option>
</select>
</div>
</fieldset>
</template>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div data-controller="field-group-repeat" data-field-group-repeat-max-value="4" data-field-group-repeat-label-value="Child"><div class="field-group-repeat" data-field-group-repeat-target="container"><fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="1"><legend class="tw:sr-only">Child 1</legend><div class="field-group-repeat-header"><span class="field-group-repeat-legend" aria-hidden="true">Child 1</span><button class="field-group-repeat-remove" >Remove</button><div class="field-group-repeat-confirm" hidden></div></div>…fields…</fieldset></div><button class="btn btn-tertiary field-group-repeat-add" data-field-group-repeat-target="add">Add another child</button><template data-field-group-repeat-target="template"></template></div></code>
</div>
</div>
<div class="tw:border-t tw:pt-6">
<h2 class="h4 tw:mb-4">Maximum reached (4 items)</h2>
<div class="callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>At the max value:</strong> the <em>Add another child</em> trigger gets the real
<code>disabled</code> attribute (kept visible and explainable rather than hidden) and a
<code>.form-text</code> hint appears underneath. All four legends are numbered in order;
removing any of them (e.g. "Child 2") renumbers the remaining three and re-enables the
add button.
</p>
</div>
<div data-controller="field-group-repeat"
data-field-group-repeat-max-value="4"
data-field-group-repeat-label-value="Child"
id="field-group-repeat-children-max">
<div class="field-group-repeat" data-field-group-repeat-target="container">
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="1">
<legend class="tw:sr-only">Child 1</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 1</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 1"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-1-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-1-name" name="children-max[1][name]"
value="Amelia Osei" aria-describedby="child-max-1-name-help">
<p class="form-text" id="child-max-1-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-1-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-1-dob" name="children-max[1][dob]" value="2016-03-12">
</div>
<div>
<label class="form-label" for="child-max-1-year">School year</label>
<select class="form-select" id="child-max-1-year" name="children-max[1][year]">
<option value="">Select year</option>
<option value="year-3" selected>Year 3</option>
<option value="year-4">Year 4</option>
<option value="year-5">Year 5</option>
</select>
</div>
</fieldset>
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="2">
<legend class="tw:sr-only">Child 2</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 2</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 2"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-2-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-2-name" name="children-max[2][name]"
value="Tobias Osei" aria-describedby="child-max-2-name-help">
<p class="form-text" id="child-max-2-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-2-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-2-dob" name="children-max[2][dob]" value="2018-09-04">
</div>
<div>
<label class="form-label" for="child-max-2-year">School year</label>
<select class="form-select" id="child-max-2-year" name="children-max[2][year]">
<option value="">Select year</option>
<option value="year-1" selected>Year 1</option>
<option value="year-2">Year 2</option>
</select>
</div>
</fieldset>
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="3">
<legend class="tw:sr-only">Child 3</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 3</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 3"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-3-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-3-name" name="children-max[3][name]"
value="Nadia Osei" aria-describedby="child-max-3-name-help">
<p class="form-text" id="child-max-3-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-3-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-3-dob" name="children-max[3][dob]" value="2020-01-22">
</div>
<div>
<label class="form-label" for="child-max-3-year">School year</label>
<select class="form-select" id="child-max-3-year" name="children-max[3][year]">
<option value="">Select year</option>
<option value="reception" selected>Reception</option>
<option value="year-1">Year 1</option>
</select>
</div>
</fieldset>
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="4">
<legend class="tw:sr-only">Child 4</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 4</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 4"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-4-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-4-name" name="children-max[4][name]"
value="Kwame Osei" aria-describedby="child-max-4-name-help">
<p class="form-text" id="child-max-4-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-4-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-4-dob" name="children-max[4][dob]" value="2022-06-30">
</div>
<div>
<label class="form-label" for="child-max-4-year">School year</label>
<select class="form-select" id="child-max-4-year" name="children-max[4][year]">
<option value="">Select year</option>
<option value="reception" selected>Reception</option>
</select>
</div>
</fieldset>
</div>
<button type="button" class="btn btn-tertiary field-group-repeat-add" data-field-group-repeat-target="add" disabled
data-action="click->field-group-repeat#add">
<i class="fa-regular fa-plus" aria-hidden="true"></i>
Add another child
</button>
<p class="form-text" data-field-group-repeat-target="maxHint">Maximum of 4 children reached.</p>
<span class="tw:sr-only" aria-live="polite" data-field-group-repeat-target="status"></span>
<template data-field-group-repeat-target="template">
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item">
<legend class="tw:sr-only">Child __INDEX__</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child __INDEX__</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child __INDEX__"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-__INDEX__-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-__INDEX__-name" name="children-max[__INDEX__][name]"
aria-describedby="child-max-__INDEX__-name-help">
<p class="form-text" id="child-max-__INDEX__-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-__INDEX__-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-__INDEX__-dob" name="children-max[__INDEX__][dob]">
</div>
<div>
<label class="form-label" for="child-max-__INDEX__-year">School year</label>
<select class="form-select" id="child-max-__INDEX__-year" name="children-max[__INDEX__][year]">
<option value="">Select year</option>
<option value="reception">Reception</option>
<option value="year-1">Year 1</option>
</select>
</div>
</fieldset>
</template>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><button class="btn btn-tertiary field-group-repeat-add" data-field-group-repeat-target="add" disabled>Add another child</button><p class="form-text" data-field-group-repeat-target="maxHint">Maximum of 4 children reached.</p></code>
</div>
</div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<div class="tw:p-6 tw:max-w-7xl tw:mx-auto tw:space-y-8">
<%# Introductory callout %>
<div class="callout">
<p class="tw:mb-1 tw:text-sm tw:font-mono">
<strong>FIELD GROUP REPEAT:</strong> "Add another" repeating group of related form fields<br>
<strong>COMPOSES:</strong> <fieldset>/<legend> | .form-control / .form-select / .form-label / .form-text | .btn-tertiary | .btn-sm .btn-danger / .btn-tertiary
</p>
<p class="tw:mb-0 tw:text-sm">
Use wherever an applicant repeats the same small set of fields for multiple people or
items — e.g. one fieldset per child on a multi-child application. Each item is numbered
("Child 1", "Child 2"…) and can be removed down to a minimum of 1. Removing an item with
unsaved changes asks for confirmation inline first; removing a clean (untouched) item
removes it immediately. <code>field_group_repeat_controller.js</code> owns cloning,
renumbering, the dirty check, and screen-reader announcements.
</p>
</div>
<%# Add another child — default %>
<div class="tw:border-t tw:pt-6">
<h2 class="h4 tw:mb-4">Add another child — default</h2>
<div class="callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>Starts at 1 item, max 4.</strong> Click <em>Add another child</em> to append a
new fieldset — legends renumber and every field's <code>name</code>/<code>id</code>/<code>for</code>
stays uniquely indexed. Fill in a field then click a <em>Remove</em> button: because the
item is now dirty, an inline confirm row replaces the trigger (Escape or Cancel backs
out). An untouched item removes immediately, no confirm. With only 1 item left, its
Remove button disables — at least one child is required. Add a 4th item and the
<em>Add another child</em> button disables at the max.
</p>
</div>
<div data-controller="field-group-repeat"
data-field-group-repeat-max-value="4"
data-field-group-repeat-label-value="Child"
id="field-group-repeat-children">
<div class="field-group-repeat" data-field-group-repeat-target="container">
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="1">
<legend class="tw:sr-only">Child 1</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 1</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 1 — at least one child is required" disabled
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-1-name">Child's full name</label>
<input type="text" class="form-control" id="child-1-name" name="children[1][name]"
aria-describedby="child-1-name-help">
<p class="form-text" id="child-1-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-1-dob">Date of birth</label>
<input type="date" class="form-control" id="child-1-dob" name="children[1][dob]">
</div>
<div>
<label class="form-label" for="child-1-year">School year</label>
<select class="form-select" id="child-1-year" name="children[1][year]">
<option value="">Select year</option>
<option value="reception">Reception</option>
<option value="year-1">Year 1</option>
<option value="year-2">Year 2</option>
<option value="year-3">Year 3</option>
<option value="year-4">Year 4</option>
<option value="year-5">Year 5</option>
<option value="year-6">Year 6</option>
<option value="year-7">Year 7</option>
<option value="year-8">Year 8</option>
<option value="year-9">Year 9</option>
<option value="year-10">Year 10</option>
<option value="year-11">Year 11</option>
</select>
</div>
</fieldset>
</div>
<button type="button" class="btn btn-tertiary field-group-repeat-add" data-field-group-repeat-target="add"
data-action="click->field-group-repeat#add">
<i class="fa-regular fa-plus" aria-hidden="true"></i>
Add another child
</button>
<p class="form-text" data-field-group-repeat-target="maxHint" hidden>Maximum of 4 children reached.</p>
<span class="tw:sr-only" aria-live="polite" data-field-group-repeat-target="status"></span>
<template data-field-group-repeat-target="template">
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item">
<legend class="tw:sr-only">Child __INDEX__</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child __INDEX__</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child __INDEX__"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-__INDEX__-name">Child's full name</label>
<input type="text" class="form-control" id="child-__INDEX__-name" name="children[__INDEX__][name]"
aria-describedby="child-__INDEX__-name-help">
<p class="form-text" id="child-__INDEX__-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-__INDEX__-dob">Date of birth</label>
<input type="date" class="form-control" id="child-__INDEX__-dob" name="children[__INDEX__][dob]">
</div>
<div>
<label class="form-label" for="child-__INDEX__-year">School year</label>
<select class="form-select" id="child-__INDEX__-year" name="children[__INDEX__][year]">
<option value="">Select year</option>
<option value="reception">Reception</option>
<option value="year-1">Year 1</option>
<option value="year-2">Year 2</option>
<option value="year-3">Year 3</option>
<option value="year-4">Year 4</option>
<option value="year-5">Year 5</option>
<option value="year-6">Year 6</option>
<option value="year-7">Year 7</option>
<option value="year-8">Year 8</option>
<option value="year-9">Year 9</option>
<option value="year-10">Year 10</option>
<option value="year-11">Year 11</option>
</select>
</div>
</fieldset>
</template>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><div data-controller="field-group-repeat" data-field-group-repeat-max-value="4" data-field-group-repeat-label-value="Child"><div class="field-group-repeat" data-field-group-repeat-target="container"><fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="1"><legend class="tw:sr-only">Child 1</legend><div class="field-group-repeat-header"><span class="field-group-repeat-legend" aria-hidden="true">Child 1</span><button class="field-group-repeat-remove" >Remove</button><div class="field-group-repeat-confirm" hidden></div></div>…fields…</fieldset></div><button class="btn btn-tertiary field-group-repeat-add" data-field-group-repeat-target="add">Add another child</button><template data-field-group-repeat-target="template"></template></div></code>
</div>
</div>
<%# Maximum reached %>
<div class="tw:border-t tw:pt-6">
<h2 class="h4 tw:mb-4">Maximum reached (4 items)</h2>
<div class="callout tw:mb-4">
<p class="tw:mb-0 tw:text-sm">
<strong>At the max value:</strong> the <em>Add another child</em> trigger gets the real
<code>disabled</code> attribute (kept visible and explainable rather than hidden) and a
<code>.form-text</code> hint appears underneath. All four legends are numbered in order;
removing any of them (e.g. "Child 2") renumbers the remaining three and re-enables the
add button.
</p>
</div>
<div data-controller="field-group-repeat"
data-field-group-repeat-max-value="4"
data-field-group-repeat-label-value="Child"
id="field-group-repeat-children-max">
<div class="field-group-repeat" data-field-group-repeat-target="container">
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="1">
<legend class="tw:sr-only">Child 1</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 1</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 1"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-1-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-1-name" name="children-max[1][name]"
value="Amelia Osei" aria-describedby="child-max-1-name-help">
<p class="form-text" id="child-max-1-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-1-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-1-dob" name="children-max[1][dob]" value="2016-03-12">
</div>
<div>
<label class="form-label" for="child-max-1-year">School year</label>
<select class="form-select" id="child-max-1-year" name="children-max[1][year]">
<option value="">Select year</option>
<option value="year-3" selected>Year 3</option>
<option value="year-4">Year 4</option>
<option value="year-5">Year 5</option>
</select>
</div>
</fieldset>
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="2">
<legend class="tw:sr-only">Child 2</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 2</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 2"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-2-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-2-name" name="children-max[2][name]"
value="Tobias Osei" aria-describedby="child-max-2-name-help">
<p class="form-text" id="child-max-2-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-2-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-2-dob" name="children-max[2][dob]" value="2018-09-04">
</div>
<div>
<label class="form-label" for="child-max-2-year">School year</label>
<select class="form-select" id="child-max-2-year" name="children-max[2][year]">
<option value="">Select year</option>
<option value="year-1" selected>Year 1</option>
<option value="year-2">Year 2</option>
</select>
</div>
</fieldset>
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="3">
<legend class="tw:sr-only">Child 3</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 3</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 3"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-3-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-3-name" name="children-max[3][name]"
value="Nadia Osei" aria-describedby="child-max-3-name-help">
<p class="form-text" id="child-max-3-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-3-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-3-dob" name="children-max[3][dob]" value="2020-01-22">
</div>
<div>
<label class="form-label" for="child-max-3-year">School year</label>
<select class="form-select" id="child-max-3-year" name="children-max[3][year]">
<option value="">Select year</option>
<option value="reception" selected>Reception</option>
<option value="year-1">Year 1</option>
</select>
</div>
</fieldset>
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item" data-index="4">
<legend class="tw:sr-only">Child 4</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child 4</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child 4"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-4-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-4-name" name="children-max[4][name]"
value="Kwame Osei" aria-describedby="child-max-4-name-help">
<p class="form-text" id="child-max-4-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-4-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-4-dob" name="children-max[4][dob]" value="2022-06-30">
</div>
<div>
<label class="form-label" for="child-max-4-year">School year</label>
<select class="form-select" id="child-max-4-year" name="children-max[4][year]">
<option value="">Select year</option>
<option value="reception" selected>Reception</option>
</select>
</div>
</fieldset>
</div>
<button type="button" class="btn btn-tertiary field-group-repeat-add" data-field-group-repeat-target="add" disabled
data-action="click->field-group-repeat#add">
<i class="fa-regular fa-plus" aria-hidden="true"></i>
Add another child
</button>
<p class="form-text" data-field-group-repeat-target="maxHint">Maximum of 4 children reached.</p>
<span class="tw:sr-only" aria-live="polite" data-field-group-repeat-target="status"></span>
<template data-field-group-repeat-target="template">
<fieldset class="field-group-repeat-item" data-field-group-repeat-target="item">
<legend class="tw:sr-only">Child __INDEX__</legend>
<div class="field-group-repeat-header">
<span class="field-group-repeat-legend" aria-hidden="true">Child __INDEX__</span>
<button type="button" class="field-group-repeat-remove" aria-label="Remove Child __INDEX__"
data-action="click->field-group-repeat#remove">
<i class="fa-regular fa-trash-can" aria-hidden="true"></i>
Remove
</button>
<div class="field-group-repeat-confirm" hidden data-action="keydown.esc->field-group-repeat#cancelConfirm">
<span>Remove this child?</span>
<button type="button" class="btn btn-sm btn-danger" data-action="click->field-group-repeat#confirmRemove">Remove</button>
<button type="button" class="btn btn-sm btn-tertiary" data-action="click->field-group-repeat#cancelConfirm">Cancel</button>
</div>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-__INDEX__-name">Child's full name</label>
<input type="text" class="form-control" id="child-max-__INDEX__-name" name="children-max[__INDEX__][name]"
aria-describedby="child-max-__INDEX__-name-help">
<p class="form-text" id="child-max-__INDEX__-name-help">Enter the name as it appears on official documents.</p>
</div>
<div class="tw:mb-3">
<label class="form-label" for="child-max-__INDEX__-dob">Date of birth</label>
<input type="date" class="form-control" id="child-max-__INDEX__-dob" name="children-max[__INDEX__][dob]">
</div>
<div>
<label class="form-label" for="child-max-__INDEX__-year">School year</label>
<select class="form-select" id="child-max-__INDEX__-year" name="children-max[__INDEX__][year]">
<option value="">Select year</option>
<option value="reception">Reception</option>
<option value="year-1">Year 1</option>
</select>
</div>
</fieldset>
</template>
</div>
<div class="tw:mt-4 tw:text-sm tw:text-gray-600">
<code><button class="btn btn-tertiary field-group-repeat-add" data-field-group-repeat-target="add" disabled>Add another child</button><p class="form-text" data-field-group-repeat-target="maxHint">Maximum of 4 children reached.</p></code>
</div>
</div>
</div>