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
<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>FORM WIZARD:</strong> Multi-step form a parent can complete without losing work or submitting twice<br> <strong>COMPOSES:</strong> .steps + steps_controller.js | .popup + popup_controller.js (discard-confirm) | .inline-notification-error (error summary) | .btn-loading + .spinner-border (submit guard) | form suite </p> <p class="tw:mb-0 tw:text-sm"> This is one fully interactive instance — try each behaviour directly. <strong>Back preserves data:</strong> fill in Step 1, click Continue, then Back — your answers are still there (panels are never destroyed, only hidden). <strong>Validation-blocked advance:</strong> leave a required field empty and click Continue — an error summary appears above the step title, focus moves to it, and the failing step gets a red exclamation mark in the rail. <strong>Discard-confirm:</strong> type something, then click Cancel — a popup asks you to confirm; Escape/overlay-click/"Keep editing" all resolve to keeping your answers, only "Discard" clears them. <strong>Review as page content:</strong> Step 3 reads back everything you entered with "Change" links back to the relevant step. This instance also persists to <code>sessionStorage</code> (<code>persist-key-value="apply-demo"</code>) — refresh the page after filling a field and your answers (and current step) come back. </p> </div> <div class="tw:border-t tw:pt-6"> <h2 class="h4 tw:mb-4">Live demo — Apply to Hills Road Sixth Form College</h2> <div class="callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Page-level only:</strong> this pattern must never be hosted inside <code>.popup</code> — <code>popup_controller.close()</code> isn't cancelable and Escape closes the topmost popup immediately, which would destroy the wizard's data before a discard-confirm could open. The <em>discard-confirm</em> itself is the one place this demo composes <code>.popup</code>. </p> </div> <div class="card"> <div class="card-body"> <div class="form-wizard steps" id="apply-wizard" data-controller="steps form-wizard" data-form-wizard-persist-key-value="apply-demo" data-action="steps:beforeNext->form-wizard#handleBeforeNext steps:changed->form-wizard#handleStepsChanged steps:completed->form-wizard#handleCompleted submit->form-wizard#handleSubmit"> <form novalidate data-form-wizard-target="form" action="/lookbook/preview/patterns/form_wizard/submitted" method="get"> <div class="form-wizard-steps steps-header"> <div class="step active" data-steps-target="step" data-form-wizard-target="stepIndicator" data-action="click->steps#goTo"> <div class="step-indicator">1</div> <div class="step-label">Child's details</div> </div> <div class="step" data-steps-target="step" data-form-wizard-target="stepIndicator" data-action="click->steps#goTo"> <div class="step-indicator">2</div> <div class="step-label">School preferences</div> </div> <div class="step" data-steps-target="step" data-form-wizard-target="stepIndicator" data-action="click->steps#goTo"> <div class="step-indicator">3</div> <div class="step-label">Review & submit</div> </div> </div> <p class="form-wizard-progress" data-form-wizard-target="progress"></p> <div class="steps-content"> <div class="form-wizard-panel steps-panel active" data-steps-target="panel" data-form-wizard-target="panel"> <h2 class="form-wizard-panel-title" tabindex="-1" data-form-wizard-target="panelTitle">Child's details</h2> <div class="tw:grid tw:grid-cols-2 tw:gap-4 tw:mb-3"> <div> <label class="form-label form-label-required" for="child-first-name">Child's first name</label> <input type="text" class="form-control" id="child-first-name" name="child_first_name" required aria-required="true" data-form-wizard-error="Enter your child's first name"> <div class="invalid-feedback" id="child-first-name-error"></div> </div> <div> <label class="form-label form-label-required" for="child-last-name">Child's last name</label> <input type="text" class="form-control" id="child-last-name" name="child_last_name" required aria-required="true" data-form-wizard-error="Enter your child's last name"> <div class="invalid-feedback" id="child-last-name-error"></div> </div> </div> <div class="tw:mb-3"> <label class="form-label form-label-required" for="child-dob">Date of birth</label> <input type="date" class="form-control tw:max-w-[240px]" id="child-dob" name="child_dob" required aria-required="true" aria-describedby="child-dob-help" data-form-wizard-error="Enter your child's date of birth"> <p class="form-text" id="child-dob-help">As it appears on their birth certificate.</p> <div class="invalid-feedback" id="child-dob-error"></div> </div> <div class="tw:mb-3"> <label class="form-label form-label-optional" for="current-school">Current school</label> <input type="text" class="form-control" id="current-school" name="current_school" placeholder="e.g. Wandsworth Primary School"> </div> </div> <div class="form-wizard-panel steps-panel" data-steps-target="panel" data-form-wizard-target="panel"> <h2 class="form-wizard-panel-title" tabindex="-1" data-form-wizard-target="panelTitle">School preferences</h2> <div class="tw:mb-3"> <label class="form-label form-label-required" for="first-choice-school">First-choice school</label> <select class="form-select" id="first-choice-school" name="first_choice_school" required aria-required="true" data-form-wizard-error="Choose your first-choice school"> <option value="">Select a school…</option> <option value="hills-road">Hills Road Sixth Form College</option> <option value="long-road">Long Road Sixth Form College</option> <option value="greenford">Greenford High School</option> </select> <div class="invalid-feedback" id="first-choice-school-error"></div> </div> <div class="tw:mb-3"> <label class="form-label form-label-required" for="parent-email">Parent or guardian email</label> <input type="email" class="form-control" id="parent-email" name="parent_email" required aria-required="true" data-form-wizard-error="Enter a parent or guardian email address"> <div class="invalid-feedback" id="parent-email-error"></div> </div> <div class="tw:mb-3"> <label class="form-label form-label-optional" for="reason">Why this school?</label> <textarea class="form-control" id="reason" name="reason" rows="3" placeholder="Anything you'd like the school to know…"></textarea> </div> <div class="form-check"> <input class="form-check-input" type="checkbox" id="sibling-attends" name="sibling_attends" value="yes"> <label class="form-check-label" for="sibling-attends">A sibling already attends this school</label> </div> </div> <div class="form-wizard-panel steps-panel" data-steps-target="panel" data-form-wizard-target="panel"> <h2 class="form-wizard-panel-title" tabindex="-1" data-form-wizard-target="panelTitle">Review your application</h2> <p class="tw:text-body-s tw:leading-body-s tw:text-neutral-700 tw:mb-4"> Check your answers before submitting. Nothing is sent until you press "Submit application". </p> <div class="tw:mb-4"> <div class="tw:flex tw:items-center tw:justify-between tw:mb-2"> <h3 class="h5 tw:mb-0">Child's details</h3> <a href="#" class="btn btn-link btn-sm" data-action="click->form-wizard#goToStep" data-form-wizard-index-param="0">Change</a> </div> <dl class="info-grid"> <div> <dt class="info-grid-label">First name</dt> <dd class="info-grid-value" data-review-value="child_first_name">Not provided</dd> </div> <div> <dt class="info-grid-label">Last name</dt> <dd class="info-grid-value" data-review-value="child_last_name">Not provided</dd> </div> <div> <dt class="info-grid-label">Date of birth</dt> <dd class="info-grid-value" data-review-value="child_dob">Not provided</dd> </div> <div> <dt class="info-grid-label">Current school</dt> <dd class="info-grid-value" data-review-value="current_school">Not provided</dd> </div> </dl> </div> <div class="tw:mb-2"> <div class="tw:flex tw:items-center tw:justify-between tw:mb-2"> <h3 class="h5 tw:mb-0">School preferences</h3> <a href="#" class="btn btn-link btn-sm" data-action="click->form-wizard#goToStep" data-form-wizard-index-param="1">Change</a> </div> <dl class="info-grid"> <div> <dt class="info-grid-label">First-choice school</dt> <dd class="info-grid-value" data-review-value="first_choice_school">Not selected</dd> </div> <div> <dt class="info-grid-label">Parent email</dt> <dd class="info-grid-value" data-review-value="parent_email">Not provided</dd> </div> <div> <dt class="info-grid-label">Sibling attends</dt> <dd class="info-grid-value" data-review-value="sibling_attends">No</dd> </div> </dl> </div> </div> </div> <div class="form-wizard-footer steps-footer"> <div class="form-wizard-footer-exit"> <a href="/lookbook/inspect/patterns/form_wizard/comprehensive" class="btn btn-link" data-form-wizard-target="discardTrigger" data-action="click->form-wizard#requestDiscard"> Cancel </a> </div> <div class="tw:flex tw:items-center tw:gap-3 tw:max-sm:flex-col tw:max-sm:items-stretch tw:max-sm:w-full"> <button type="button" class="btn btn-secondary tw:max-sm:w-full" data-steps-target="backBtn" data-action="click->steps#back">Back</button> <button type="button" class="btn btn-primary tw:max-sm:w-full" data-form-wizard-target="submitBtn" data-action="click->steps#next">Continue</button> </div> <span class="tw:sr-only" aria-live="polite" data-form-wizard-target="status"></span> </div> </form> <div data-form-wizard-role="discard-popup" data-controller="popup"> <div class="popup-overlay" data-popup-target="overlay" data-action="click->popup#handleOverlayClick"></div> <div class="popup-panel popup-sm popup-center" data-popup-target="panel"> <div class="popup-header"> <h2 class="popup-header-title">Discard this application?</h2> </div> <div class="popup-body"> <p class="tw:mb-0"> Nothing has been sent to Hills Road Sixth Form College. If you discard, the answers you've entered will be deleted. </p> </div> <div class="popup-footer"> <button type="button" class="btn btn-secondary" data-popup-target="autofocus" data-action="click->popup#close">Keep editing</button> <button type="button" class="btn btn-danger" data-action="click->form-wizard#confirmDiscard">Discard</button> </div> </div> </div> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="form-wizard steps" data-controller="steps form-wizard" data-form-wizard-persist-key-value="apply-demo" data-action="steps:beforeNext->form-wizard#handleBeforeNext steps:changed->form-wizard#handleStepsChanged steps:completed->form-wizard#handleCompleted submit->form-wizard#handleSubmit"><form novalidate data-form-wizard-target="form"><div class="form-wizard-steps steps-header">…</div><p class="form-wizard-progress" data-form-wizard-target="progress"></p><div class="steps-content"><div class="form-wizard-panel steps-panel active" data-steps-target="panel" data-form-wizard-target="panel"><h2 class="form-wizard-panel-title" tabindex="-1" data-form-wizard-target="panelTitle">…</h2>…</div>…</div><div class="form-wizard-footer steps-footer"><div class="form-wizard-footer-exit"><a class="btn btn-link" data-form-wizard-target="discardTrigger" data-action="click->form-wizard#requestDiscard">Cancel</a></div><button type="button" data-steps-target="backBtn" data-action="click->steps#back">Back</button><button type="button" data-form-wizard-target="submitBtn" data-action="click->steps#next">Continue</button></div></form><div data-form-wizard-role="discard-popup" data-controller="popup">…</div></div></code> </div> </div> <div class="tw:border-t tw:pt-6"> <h2 class="h4 tw:mb-4">Error summary + field marking (C08 recipe)</h2> <div class="callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Timing:</strong> validation only runs on Continue/Submit — never on keystroke. Once a field is marked invalid, it re-validates live on input/blur and clears itself (and its summary row) the instant it passes. Each summary link's text is the identical string as that field's <code>.invalid-feedback</code> — both are set from the same <code>data-form-wizard-error</code> source, so the two can never drift apart. </p> </div> <div class="form-wizard-error-summary inline-notification inline-notification-error tw:mb-4" role="alert" tabindex="-1"> <div class="inline-notification-icon"><i class="fa-solid fa-circle-exclamation" aria-hidden="true"></i></div> <div class="inline-notification-content"> <p class="inline-notification-title">2 answers need attention before you continue</p> <div class="inline-notification-message"> <ul class="form-wizard-error-summary-list"> <li><a href="#demo-child-first-name" class="form-wizard-error-summary-link">Enter your child's first name</a></li> <li><a href="#demo-child-dob" class="form-wizard-error-summary-link">Enter your child's date of birth</a></li> </ul> </div> </div> </div> <div class="tw:grid tw:grid-cols-2 tw:gap-4"> <div> <label class="form-label form-label-required" for="demo-child-first-name">Child's first name</label> <input type="text" class="form-control is-invalid" id="demo-child-first-name" aria-invalid="true" aria-describedby="demo-child-first-name-error" required> <div class="invalid-feedback" id="demo-child-first-name-error">Enter your child's first name</div> </div> <div> <label class="form-label form-label-required" for="demo-child-dob">Date of birth</label> <input type="date" class="form-control is-invalid" id="demo-child-dob" aria-invalid="true" aria-describedby="demo-child-dob-help demo-child-dob-error" required> <p class="form-text" id="demo-child-dob-help">As it appears on their birth certificate.</p> <div class="invalid-feedback" id="demo-child-dob-error">Enter your child's date of birth</div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="form-wizard-error-summary inline-notification inline-notification-error" role="alert" tabindex="-1"><div class="inline-notification-icon">…</div><div class="inline-notification-content"><p class="inline-notification-title">1 answer needs attention before you continue</p><div class="inline-notification-message"><ul class="form-wizard-error-summary-list"><li><a href="#field-id" class="form-wizard-error-summary-link">Enter your child's first name</a></li></ul></div></div></div> … <div class="invalid-feedback" id="field-id-error">Enter your child's first name</div></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
<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>FORM WIZARD:</strong> Multi-step form a parent can complete without losing work or submitting twice<br> <strong>COMPOSES:</strong> .steps + steps_controller.js | .popup + popup_controller.js (discard-confirm) | .inline-notification-error (error summary) | .btn-loading + .spinner-border (submit guard) | form suite </p> <p class="tw:mb-0 tw:text-sm"> This is one fully interactive instance — try each behaviour directly. <strong>Back preserves data:</strong> fill in Step 1, click Continue, then Back — your answers are still there (panels are never destroyed, only hidden). <strong>Validation-blocked advance:</strong> leave a required field empty and click Continue — an error summary appears above the step title, focus moves to it, and the failing step gets a red exclamation mark in the rail. <strong>Discard-confirm:</strong> type something, then click Cancel — a popup asks you to confirm; Escape/overlay-click/"Keep editing" all resolve to keeping your answers, only "Discard" clears them. <strong>Review as page content:</strong> Step 3 reads back everything you entered with "Change" links back to the relevant step. This instance also persists to <code>sessionStorage</code> (<code>persist-key-value="apply-demo"</code>) — refresh the page after filling a field and your answers (and current step) come back. </p> </div> <%# Live demo %> <div class="tw:border-t tw:pt-6"> <h2 class="h4 tw:mb-4">Live demo — Apply to Hills Road Sixth Form College</h2> <div class="callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Page-level only:</strong> this pattern must never be hosted inside <code>.popup</code> — <code>popup_controller.close()</code> isn't cancelable and Escape closes the topmost popup immediately, which would destroy the wizard's data before a discard-confirm could open. The <em>discard-confirm</em> itself is the one place this demo composes <code>.popup</code>. </p> </div> <div class="card"> <div class="card-body"> <div class="form-wizard steps" id="apply-wizard" data-controller="steps form-wizard" data-form-wizard-persist-key-value="apply-demo" data-action="steps:beforeNext->form-wizard#handleBeforeNext steps:changed->form-wizard#handleStepsChanged steps:completed->form-wizard#handleCompleted submit->form-wizard#handleSubmit"> <form novalidate data-form-wizard-target="form" action="/lookbook/preview/patterns/form_wizard/submitted" method="get"> <div class="form-wizard-steps steps-header"> <div class="step active" data-steps-target="step" data-form-wizard-target="stepIndicator" data-action="click->steps#goTo"> <div class="step-indicator">1</div> <div class="step-label">Child's details</div> </div> <div class="step" data-steps-target="step" data-form-wizard-target="stepIndicator" data-action="click->steps#goTo"> <div class="step-indicator">2</div> <div class="step-label">School preferences</div> </div> <div class="step" data-steps-target="step" data-form-wizard-target="stepIndicator" data-action="click->steps#goTo"> <div class="step-indicator">3</div> <div class="step-label">Review & submit</div> </div> </div> <p class="form-wizard-progress" data-form-wizard-target="progress"></p> <div class="steps-content"> <%# Step 1 — Child's details %> <div class="form-wizard-panel steps-panel active" data-steps-target="panel" data-form-wizard-target="panel"> <h2 class="form-wizard-panel-title" tabindex="-1" data-form-wizard-target="panelTitle">Child's details</h2> <div class="tw:grid tw:grid-cols-2 tw:gap-4 tw:mb-3"> <div> <label class="form-label form-label-required" for="child-first-name">Child's first name</label> <input type="text" class="form-control" id="child-first-name" name="child_first_name" required aria-required="true" data-form-wizard-error="Enter your child's first name"> <div class="invalid-feedback" id="child-first-name-error"></div> </div> <div> <label class="form-label form-label-required" for="child-last-name">Child's last name</label> <input type="text" class="form-control" id="child-last-name" name="child_last_name" required aria-required="true" data-form-wizard-error="Enter your child's last name"> <div class="invalid-feedback" id="child-last-name-error"></div> </div> </div> <div class="tw:mb-3"> <label class="form-label form-label-required" for="child-dob">Date of birth</label> <input type="date" class="form-control tw:max-w-[240px]" id="child-dob" name="child_dob" required aria-required="true" aria-describedby="child-dob-help" data-form-wizard-error="Enter your child's date of birth"> <p class="form-text" id="child-dob-help">As it appears on their birth certificate.</p> <div class="invalid-feedback" id="child-dob-error"></div> </div> <div class="tw:mb-3"> <label class="form-label form-label-optional" for="current-school">Current school</label> <input type="text" class="form-control" id="current-school" name="current_school" placeholder="e.g. Wandsworth Primary School"> </div> </div> <%# Step 2 — School preferences %> <div class="form-wizard-panel steps-panel" data-steps-target="panel" data-form-wizard-target="panel"> <h2 class="form-wizard-panel-title" tabindex="-1" data-form-wizard-target="panelTitle">School preferences</h2> <div class="tw:mb-3"> <label class="form-label form-label-required" for="first-choice-school">First-choice school</label> <select class="form-select" id="first-choice-school" name="first_choice_school" required aria-required="true" data-form-wizard-error="Choose your first-choice school"> <option value="">Select a school…</option> <option value="hills-road">Hills Road Sixth Form College</option> <option value="long-road">Long Road Sixth Form College</option> <option value="greenford">Greenford High School</option> </select> <div class="invalid-feedback" id="first-choice-school-error"></div> </div> <div class="tw:mb-3"> <label class="form-label form-label-required" for="parent-email">Parent or guardian email</label> <input type="email" class="form-control" id="parent-email" name="parent_email" required aria-required="true" data-form-wizard-error="Enter a parent or guardian email address"> <div class="invalid-feedback" id="parent-email-error"></div> </div> <div class="tw:mb-3"> <label class="form-label form-label-optional" for="reason">Why this school?</label> <textarea class="form-control" id="reason" name="reason" rows="3" placeholder="Anything you'd like the school to know…"></textarea> </div> <div class="form-check"> <input class="form-check-input" type="checkbox" id="sibling-attends" name="sibling_attends" value="yes"> <label class="form-check-label" for="sibling-attends">A sibling already attends this school</label> </div> </div> <%# Step 3 — Review (page content, not a new pattern class — spec §11 Q3) %> <div class="form-wizard-panel steps-panel" data-steps-target="panel" data-form-wizard-target="panel"> <h2 class="form-wizard-panel-title" tabindex="-1" data-form-wizard-target="panelTitle">Review your application</h2> <p class="tw:text-body-s tw:leading-body-s tw:text-neutral-700 tw:mb-4"> Check your answers before submitting. Nothing is sent until you press "Submit application". </p> <div class="tw:mb-4"> <div class="tw:flex tw:items-center tw:justify-between tw:mb-2"> <h3 class="h5 tw:mb-0">Child's details</h3> <a href="#" class="btn btn-link btn-sm" data-action="click->form-wizard#goToStep" data-form-wizard-index-param="0">Change</a> </div> <dl class="info-grid"> <div> <dt class="info-grid-label">First name</dt> <dd class="info-grid-value" data-review-value="child_first_name">Not provided</dd> </div> <div> <dt class="info-grid-label">Last name</dt> <dd class="info-grid-value" data-review-value="child_last_name">Not provided</dd> </div> <div> <dt class="info-grid-label">Date of birth</dt> <dd class="info-grid-value" data-review-value="child_dob">Not provided</dd> </div> <div> <dt class="info-grid-label">Current school</dt> <dd class="info-grid-value" data-review-value="current_school">Not provided</dd> </div> </dl> </div> <div class="tw:mb-2"> <div class="tw:flex tw:items-center tw:justify-between tw:mb-2"> <h3 class="h5 tw:mb-0">School preferences</h3> <a href="#" class="btn btn-link btn-sm" data-action="click->form-wizard#goToStep" data-form-wizard-index-param="1">Change</a> </div> <dl class="info-grid"> <div> <dt class="info-grid-label">First-choice school</dt> <dd class="info-grid-value" data-review-value="first_choice_school">Not selected</dd> </div> <div> <dt class="info-grid-label">Parent email</dt> <dd class="info-grid-value" data-review-value="parent_email">Not provided</dd> </div> <div> <dt class="info-grid-label">Sibling attends</dt> <dd class="info-grid-value" data-review-value="sibling_attends">No</dd> </div> </dl> </div> </div> </div> <div class="form-wizard-footer steps-footer"> <div class="form-wizard-footer-exit"> <a href="/lookbook/inspect/patterns/form_wizard/comprehensive" class="btn btn-link" data-form-wizard-target="discardTrigger" data-action="click->form-wizard#requestDiscard"> Cancel </a> </div> <div class="tw:flex tw:items-center tw:gap-3 tw:max-sm:flex-col tw:max-sm:items-stretch tw:max-sm:w-full"> <button type="button" class="btn btn-secondary tw:max-sm:w-full" data-steps-target="backBtn" data-action="click->steps#back">Back</button> <button type="button" class="btn btn-primary tw:max-sm:w-full" data-form-wizard-target="submitBtn" data-action="click->steps#next">Continue</button> </div> <span class="tw:sr-only" aria-live="polite" data-form-wizard-target="status"></span> </div> </form> <%# Discard-confirm popup — composed, not forked. Lives outside the <form> (a nested form inside a form is invalid HTML) but inside the wizard root so goToStep-style controller lookups stay scoped to this instance. %> <div data-form-wizard-role="discard-popup" data-controller="popup"> <div class="popup-overlay" data-popup-target="overlay" data-action="click->popup#handleOverlayClick"></div> <div class="popup-panel popup-sm popup-center" data-popup-target="panel"> <div class="popup-header"> <h2 class="popup-header-title">Discard this application?</h2> </div> <div class="popup-body"> <p class="tw:mb-0"> Nothing has been sent to Hills Road Sixth Form College. If you discard, the answers you've entered will be deleted. </p> </div> <div class="popup-footer"> <button type="button" class="btn btn-secondary" data-popup-target="autofocus" data-action="click->popup#close">Keep editing</button> <button type="button" class="btn btn-danger" data-action="click->form-wizard#confirmDiscard">Discard</button> </div> </div> </div> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="form-wizard steps" data-controller="steps form-wizard" data-form-wizard-persist-key-value="apply-demo" data-action="steps:beforeNext->form-wizard#handleBeforeNext steps:changed->form-wizard#handleStepsChanged steps:completed->form-wizard#handleCompleted submit->form-wizard#handleSubmit"><form novalidate data-form-wizard-target="form"><div class="form-wizard-steps steps-header">…</div><p class="form-wizard-progress" data-form-wizard-target="progress"></p><div class="steps-content"><div class="form-wizard-panel steps-panel active" data-steps-target="panel" data-form-wizard-target="panel"><h2 class="form-wizard-panel-title" tabindex="-1" data-form-wizard-target="panelTitle">…</h2>…</div>…</div><div class="form-wizard-footer steps-footer"><div class="form-wizard-footer-exit"><a class="btn btn-link" data-form-wizard-target="discardTrigger" data-action="click->form-wizard#requestDiscard">Cancel</a></div><button type="button" data-steps-target="backBtn" data-action="click->steps#back">Back</button><button type="button" data-form-wizard-target="submitBtn" data-action="click->steps#next">Continue</button></div></form><div data-form-wizard-role="discard-popup" data-controller="popup">…</div></div></code> </div> </div> <%# Field-level error contract %> <div class="tw:border-t tw:pt-6"> <h2 class="h4 tw:mb-4">Error summary + field marking (C08 recipe)</h2> <div class="callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Timing:</strong> validation only runs on Continue/Submit — never on keystroke. Once a field is marked invalid, it re-validates live on input/blur and clears itself (and its summary row) the instant it passes. Each summary link's text is the identical string as that field's <code>.invalid-feedback</code> — both are set from the same <code>data-form-wizard-error</code> source, so the two can never drift apart. </p> </div> <div class="form-wizard-error-summary inline-notification inline-notification-error tw:mb-4" role="alert" tabindex="-1"> <div class="inline-notification-icon"><i class="fa-solid fa-circle-exclamation" aria-hidden="true"></i></div> <div class="inline-notification-content"> <p class="inline-notification-title">2 answers need attention before you continue</p> <div class="inline-notification-message"> <ul class="form-wizard-error-summary-list"> <li><a href="#demo-child-first-name" class="form-wizard-error-summary-link">Enter your child's first name</a></li> <li><a href="#demo-child-dob" class="form-wizard-error-summary-link">Enter your child's date of birth</a></li> </ul> </div> </div> </div> <div class="tw:grid tw:grid-cols-2 tw:gap-4"> <div> <label class="form-label form-label-required" for="demo-child-first-name">Child's first name</label> <input type="text" class="form-control is-invalid" id="demo-child-first-name" aria-invalid="true" aria-describedby="demo-child-first-name-error" required> <div class="invalid-feedback" id="demo-child-first-name-error">Enter your child's first name</div> </div> <div> <label class="form-label form-label-required" for="demo-child-dob">Date of birth</label> <input type="date" class="form-control is-invalid" id="demo-child-dob" aria-invalid="true" aria-describedby="demo-child-dob-help demo-child-dob-error" required> <p class="form-text" id="demo-child-dob-help">As it appears on their birth certificate.</p> <div class="invalid-feedback" id="demo-child-dob-error">Enter your child's date of birth</div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="form-wizard-error-summary inline-notification inline-notification-error" role="alert" tabindex="-1"><div class="inline-notification-icon">…</div><div class="inline-notification-content"><p class="inline-notification-title">1 answer needs attention before you continue</p><div class="inline-notification-message"><ul class="form-wizard-error-summary-list"><li><a href="#field-id" class="form-wizard-error-summary-link">Enter your child's first name</a></li></ul></div></div></div> … <div class="invalid-feedback" id="field-id-error">Enter your child's first name</div></code> </div> </div></div>No notes provided.
No params configured.