StaffCoder
TypeScript
Vanilla TypeScriptTypeScript 7.0
6 modules · 24 challengesSign up
Modules6 modules · 24 challenges
Build production-shaped form flows in Vanilla TypeScript. The topic covers pure validate functions that return typed error maps, per-field render helpers that manage aria-invalid and aria-describedby, touched-on-blur error surfacing, submit gating tied to live validity, dirty tracking against a baseline with beforeunload prompts, conditional field groups driven by a discriminant that also shape the outgoing payload, and async submission with confirmation and rejection paths. The recurring lesson: pure logic decides what's wrong, small render helpers put that decision on the page, and payloads leaving the form are trimmed, typed, and contain nothing from a hidden field group.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Insurance Quote Form

Sign up to unlock
0%0 of 1 solvedeasy
About this challenge

Implement visibleFieldNames, validate, renderGroups, renderFieldError, and renderPayload. The insurance-type select reveals one of three groups (Auto / Home / Life); switching type clears the previously visible group's inputs; validation reports errors only for currently visible fields; a valid submit renders a JSON payload with the common fields plus the visible group's fields only.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Profile Settings Editor

Sign up to unlock
—No data yeteasy
About this challenge

Implement isDirty, validate, and the render helpers (renderValues, renderFieldError, renderSaveEnabled, renderSavedFlash). Save enables the moment values diverge from the baseline and disables when they match again; a valid save promotes current values to the new baseline; Reset restores the baseline; and the browser's beforeunload prompt fires only while the form is dirty.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Member Signup Form

Sign up to unlock
0%0 of 1 solvedeasy
About this challenge

Implement validate and the renderFieldError, renderSubmitEnabled, renderSuccess helpers. Errors appear only after a field is blurred, aria-invalid and aria-describedby toggle in lockstep with the message, the submit button tracks live validity across name / email / password (min 8) / confirm, and mismatch is reported on the confirm field only. A valid submit clears the form, re-disables submit, and reveals the success

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Studio Booking Submission

STAR
Solving it completes the module
—No data yeteasy
About this challenge

Implement validate, buildPayload, and the renderFieldError, renderFormDisabled, renderSubmitError, renderConfirmation helpers. On submit, the form validates, normalises raw inputs (trimmed strings, numeric fields as number, ISO date passthrough), disables every input while awaiting window.submitBooking(payload), and either reveals a confirmation with the returned reference or re-enables the form and surfaces the rejection message with typed values preserved.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.