freeCodeCamp/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-forms-by-buildin.../60fab4a123ce4b04526b082b.md

2.4 KiB

id title challengeType dashedName
60fab4a123ce4b04526b082b Passo 25 0 step-25

--description--

Apenas uma entrada com botão de opção deve ser selecionável por vez. No entanto, o formulário não sabe se as entradas de botão de opção estão relacionadas.

Para relacionar as entradas com botão de opção, dê a elas o mesmo atributo name atributo com um valor de account-type. Agora, não é possível selecionar ambas as entradas de botão de opção ao mesmo tempo.

--hints--

Você deve dar à primeira entrada de botão de opção o atributo name com um valor de account-type.

assert.equal(document.querySelector('fieldset:nth-child(2) label:nth-child(1) input[type="radio"]')?.name, 'account-type');

Você deve dar à segunda entrada de botão de opção o atributo name com um valor de account-type.

assert.equal(document.querySelector('fieldset:nth-child(2) label:nth-child(2) input[type="radio"]')?.name, 'account-type');

O elemento checkbox não deve ter o atributo name.

assert.isEmpty(document.querySelector('fieldset:nth-child(2) label:nth-child(3) input[type="checkbox"]')?.name);

--seed--

--seed-contents--

<!DOCTYPE html>
<html>
  <head>
    <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>
    <form action='https://register-demo.freecodecamp.org'>
      <fieldset>
        <label>Enter Your First Name: <input type="text" required /></label>
        <label>Enter Your Last Name: <input type="text" required /></label>
        <label>Enter Your Email: <input type="email" required /></label>
        <label>Create a New Password: <input type="password" pattern="[a-z0-5]{8,}" required /></label>
      </fieldset>
--fcc-editable-region--
      <fieldset>
        <label><input type="radio" /> Personal Account</label>
        <label><input type="radio" /> Business Account</label>
        <label><input type="checkbox" required /> I accept the terms and conditions</label>
      </fieldset>
--fcc-editable-region--
      <fieldset></fieldset>
      <input type="submit" value="Submit" />
    </form>
  </body>
</html>
body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color: #1b1b32;
    color: #f5f6f7;
}

label {
    display: block;
    margin: 0.5rem 0;
}