forked from vercel/next.js
/
no-js-form.tsx
35 lines (33 loc) · 1.15 KB
/
no-js-form.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import Link from 'next/link'
import styles from '../styles/Home.module.css'
export default function Form() {
return (
<div className="container">
<h1 className={styles.title}>
Form{' '}
<Link href="/">
<a>without</a>
</Link>{' '}
JavaScript.
</h1>
<p className={styles.description}>
Get started by looking at{' '}
<code className={styles.code}>pages/no-js-form.js</code>
</p>
{/*
* action: The action attribute defines where the data gets sent.
* Its value must be a valid relative or absolute URL.
* If this attribute isn't provided, the data will be sent to the URL
* of the page containing the form — the current page.
* method: The HTTP method to submit the form with. (case insensitive)
*/}
<form action="/api/form" method="post">
<label htmlFor="first">First Name</label>
<input type="text" id="first" name="first" required />
<label htmlFor="last">Last Name</label>
<input type="text" id="last" name="last" required />
<button type="submit">Submit</button>
</form>
</div>
)
}