# Basic Validation — HTML

Source: https://www.geekswithgeeks.com/en/html/html-form-validation

> Built-in attributes that check input before submit.

## required, pattern, min, max

The browser blocks submission and shows a message until these constraints are met.

```html
<input type="text" required minlength="3">
<input type="number" min="1" max="10">
<input type="text" pattern="[A-Za-z]+" title="Letters only">
```

## Not a security fence

HTML validation runs in the browser and can be bypassed — always **re-validate on the server** too.

**Quiz:** Which attribute makes a field mandatory before submit?

- [x] required
- [ ] placeholder
- [ ] readonly

*Answer:* required. `required` blocks form submission until that field has a value.
