# Forms and User Input

> Build forms that validate clearly, submit reliably and stay accessible, using React Hook Form with shared Zod schemas. Free notes, key concepts, resources and...

Canonical: https://www.internhack.in/roadmaps/tracks/full-stack/forms
Last updated: 2026-11-28

Build forms that validate clearly, submit reliably and stay accessible, using React Hook Form with shared Zod schemas.

Intermediate · about 6 hours · difficulty 3/5

Learn first: [State, Effects and Hooks](https://www.internhack.in/roadmaps/tracks/full-stack/react-hooks-and-state), [Runtime Validation with Zod](https://www.internhack.in/roadmaps/tracks/full-stack/runtime-validation)

Forms are where users give your app data: signups, job applications, payment details. They must be fast, clear and forgiving.

### Controlled vs uncontrolled

Controlled inputs keep every keystroke in React state; uncontrolled inputs let the DOM hold the value and read it on submit. For larger forms, **React Hook Form** uses uncontrolled inputs under the hood, which keeps re-renders low.

### Validation that helps

- Plug your **Zod schema** into React Hook Form with a resolver, so client and server share rules.
- Show errors next to the field, in text, after the user leaves the field or submits.
- Disable the submit button while submitting, and show server errors (like "email already registered") clearly.

### Submission

Send JSON with fetch or call a server action. Handle success (redirect or toast), validation errors (map them back to fields) and network failures (keep the user's input; never wipe the form on error).

### Special inputs

File uploads, date pickers, phone numbers with country codes, and multi-step wizards each have quirks. Prefer native inputs where possible for accessibility and mobile keyboards.

### Pitfalls

- Validating on every keystroke and showing red errors before the user has finished typing.
- Losing all input when a request fails.
- Double submissions creating duplicate records.

You are ready to move on when you can build a multi-step internship application form with shared validation, clear errors and safe submission.

## Key concepts

- **Controlled vs uncontrolled inputs**
- **React Hook Form**
- **Zod resolver and shared schemas**
- **Error display and timing**
- **Submit states and double submits**
- **File inputs**
- **Multi-step forms**

## Mini project

Build a three-step internship application (personal details, education with CGPA, resume link and cover note) with React Hook Form and Zod, a review step, and a mock submit that sometimes fails so you handle errors.

## Check yourself

How do you prevent a user who double-clicks Submit from creating two applications, on both the client and the server?

## Free resources

- [React Hook Form](https://react-hook-form.com/) (React Hook Form)
- [Reacting to Input with State](https://react.dev/learn/reacting-to-input-with-state) (React)
- [Learn Forms](https://web.dev/learn/forms) (web.dev)

Previous: [State, Effects and Hooks](https://www.internhack.in/roadmaps/tracks/full-stack/react-hooks-and-state) · Next: [Styling with Tailwind CSS](https://www.internhack.in/roadmaps/tracks/full-stack/tailwind-css)

## More in React for Interfaces

- [React Fundamentals](https://www.internhack.in/roadmaps/tracks/full-stack/react-fundamentals)
- [State, Effects and Hooks](https://www.internhack.in/roadmaps/tracks/full-stack/react-hooks-and-state)
- [Forms and User Input](https://www.internhack.in/roadmaps/tracks/full-stack/forms)
- [Styling with Tailwind CSS](https://www.internhack.in/roadmaps/tracks/full-stack/tailwind-css)
- [Styling with CSS Modules](https://www.internhack.in/roadmaps/tracks/full-stack/css-modules)
- [Server State with TanStack Query](https://www.internhack.in/roadmaps/tracks/full-stack/server-state-tanstack-query)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Full-Stack Developer Roadmap](https://www.internhack.in/roadmaps/tracks/full-stack)
