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

104 lines
3.2 KiB
Markdown

---
id: 7cf9b03d81a65668421804c3
title: Passo 39
challengeType: 0
dashedName: step-39
---
# --description--
Para que os dados de um formulário sejam acessados pelo local especificado no atributo `action`, você deve dar ao campo de texto um atributo `name` e atribuir a ele um valor que represente os dados que estão sendo enviados. Por exemplo, você pode usar a sintaxe a seguir para um campo de texto de endereço de e-mail: `<input type="text" name="email">`.
Adicione o atributo `name` com o valor `catphotourl` para o campo de texto.
# --hints--
Você excluiu o elemento `input` ou ele tem uma sintaxe inválida. Os valores de todos os atributos devem estar cercados com aspas.
```js
assert($('input').length);
```
O elemento `form` deve conter apenas o elemento `input`. Remova os elementos HTML ou o texto adicionais do elemento `form`.
```js
assert(
$('form')[0].children.length === 1 &&
$('form')[0].innerText.trim().length === 0
);
```
O elemento `input` não tem um atributo `name`. 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.
```js
assert($('input')[0].hasAttribute('name'));
```
O elemento `input` deve ter um atributo `name` com o valor `catphotourl`. Você omitiu o valor ou tem um erro de digitação. Lembre-se de que os valores dos atributos devem estar cercados com aspas.
```js
assert(
$('input')[0]
.getAttribute('name')
.match(/^catphotourl$/i)
);
```
Embora você tenha definido o atributo `name` do elemento `input` com o valor `catphotourl`, é recomendável sempre cercar o valor de um atributo com aspas.
```js
assert(!/\<\s*input\s+.*\s*=\s*catphotourl/.test(code));
```
# --seed--
## --seed-contents--
```html
<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>
<form action="https://freecatphotoapp.com/submit-cat-photo">
--fcc-editable-region--
<input type="text">
--fcc-editable-region--
</form>
</section>
</main>
</body>
</html>
```