Back to Freecodecamp

Step 12

curriculum/challenges/english/blocks/learn-html-forms-by-building-a-registration-form/63541ef4f96cd82e8e6c788a.md

latest1.3 KB
Original Source

--description--

The method attribute specifies how to send form-data to the URL specified in the action attribute. The form-data can be sent via a GET request as URL parameters (with method="get") or via a POST request as data in the request body (with method="post").

Set the method attribute to send your form data via a POST request.

--hints--

You shouldn't add a new form element.

js
assert.equal(document.querySelectorAll('form').length, 1 )

Your form element should have a method attribute.

js
assert.exists(document.querySelector('form')?.getAttribute('method'));

Your method attribute should be set to post.

js
assert.match(document.querySelector('form')?.getAttribute('method'), /^post$/i);

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Registration Form</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <h1>Registration Form</h1>
    <p>Please fill out this form with the required information</p>
    --fcc-editable-region--
    <form action='https://register-demo.freecodecamp.org'></form>
--fcc-editable-region--
  </body>
</html>
css
body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color: #1b1b32;
  color: #f5f6f7;
}