Homework

Homework — the registration form

Homework — the registration form.

  1. Contact cross-field validation. Create contact.js with rules(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.
  2. Submit lifecycle. Implement disabled → "Sending…" → success/error → restore with try/catch/finally. Check that after an error (@example.com) the button resets.
  3. Password strength. In register.js, attach checkPassword to input; the meter and requirements should update live.
  4. Live confirmation. Enter the confirmation, then change the first password — the confirmation error should re-validate immediately.
  5. 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.