Homework
Homework — the registration form
Homework — the registration form.
- Contact cross-field validation. Create
contact.jswithrules(values)where "Bug report" raises the message minimum to 50. Pick "Bug report", type 30 characters — error; pick "Question" — the same message is now fine. - Submit lifecycle. Implement
disabled → "Sending…" → success/error → restorewithtry/catch/finally. Check that after an error (@example.com) the button resets. - Password strength. In
register.js, attachcheckPasswordtoinput; the meter and requirements should update live. - Live confirmation. Enter the confirmation, then change the first password — the confirmation error should re-validate immediately.
- Async check. Implement
isUsernameTaken(simulated). Enter "admin" → "already taken". Enter a free name → no error.
Required tests:
- Cross-field test: the subject changes the message minimum.
- Async test: "admin"/"nasa" are rejected; others pass.
- Security understanding: you can explain why the password is never stored in the browser.
To submit: a video: (1) the cross-field message rule, (2) the strength meter + live confirmation, (3) "admin" → already taken.
Next. Forms are done. In lesson 13 — modals, dialogs and toasts, and with them a real accessibility (a11y) bug we fixed: focus escaping an open modal. So a keyboard user isn't lost, a modal must move focus in, trap it, and restore it.