freeCodeCamp/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-html-by-building-a-ca.../5ef9b03c81a63668521804d7.md

3.5 KiB

id title challengeType dashedName
5ef9b03c81a63668521804d7 Passo 35 0 step-35

--description--

O atributo action indica para onde os dados do formulário devem ser enviados. Por exemplo, <form action="/submit-url"></form> informa ao navegador que os dados do formulário devem ser enviados para o caminho /submit-url.

Adicione um atributo action com o valor https://freecatphotoapp.com/submit-cat-photo ao elemento form.

--hints--

O elemento form deve ter uma tag de abertura e uma de fechamento na ordem correta. Pode ser que você não tenha inserido uma delas, as duas, ou que elas estejam na ordem errada.

const noSpaces = code.replace(/\s/g, '');
assert(
  document.querySelector('form') &&
    code.match(/<\/form>/g) &&
    noSpaces.indexOf('<form') < noSpaces.indexOf('</form>')
);

O elemento form dentro do último elemento section deve estar abaixo do elemento h2. O elemento h2 e o elemento form estão na ordem errada.

assert(document.querySelector('form').previousElementSibling.nodeName === 'H2');

O elemento form não deve ter conteúdo. Remova os elementos HTML ou o texto entre as tags do elemento form.

assert($('form')[0].innerHTML.trim().length === 0);

O elemento form não tem um atributo action. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos.

const form = document.querySelector('form');
assert(form.hasAttribute('action'));

O elemento form deve ter o atributo action com o valor https://freecatphotoapp.com/submit-cat-photo.

const form = document.querySelector('form');
assert(
  form
    .getAttribute('action')
    .match(/^https:\/\/freecatphotoapp\.com\/submit-cat-photo$/)
);

Embora você tenha definido o valor do atributo action com o URL correto, é recomendável sempre cercar o valor de um atributo com aspas.

assert(
  !/\<form\s+action\s*=\s*https:\/\/freecatphotoapp\.com\/submit-cat-photo/.test(
    code
  )
);

--seed--

--seed-contents--

<html>
  <body>
    <h1>CatPhotoApp</h1>
    <main>
      <section>
        <h2>Cat Photos</h2>
        <!-- TODO: Add link to cat photos -->
        <p>Click here to view more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a>.</p>
        <a href="https://freecatphotoapp.com"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
      </section>
      <section>
        <h2>Cat Lists</h2>
        <h3>Things cats love:</h3>
        <ul>
          <li>cat nip</li>
          <li>laser pointers</li>
          <li>lasagna</li>
        </ul>
        <figure>
          <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg" alt="A slice of lasagna on a plate.">
          <figcaption>Cats <em>love</em> lasagna.</figcaption>  
        </figure>
        <h3>Top 3 things cats hate:</h3>
        <ol>
          <li>flea treatment</li>
          <li>thunder</li>
          <li>other cats</li>
        </ol>
        <figure>
          <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg" alt="Five cats looking around a field.">
          <figcaption>Cats <strong>hate</strong> other cats.</figcaption>  
        </figure>
      </section>
      <section>
        <h2>Cat Form</h2>
--fcc-editable-region--
        <form>
        </form>
--fcc-editable-region--
      </section>
    </main>
  </body>
</html>