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

104 lines
3.2 KiB
Markdown

---
id: 7cf9b03d81a65668421804c3
title: Step 39
challengeType: 0
dashedName: step-39
---
# --description--
Per accedere ai dati di un modulo dalla posizione specificata nell'attributo `action`, devi dare al campo di testo un attributo `name` e assegnargli un valore per rappresentare i dati inviati. Per esempio, puoi utilizzare la seguente sintassi per un campo di testo per indirizzo email: `<input type="text" name="email">`.
Aggiungi l'attributo `name` con il valore `catphotourl` al tuo campo di testo.
# --hints--
Hai cancellato l'elemento `input` oppure ha una sintassi non valida. Tutti i valori degli attributi dovrebbero essere circondati da virgolette.
```js
assert($('input').length);
```
L'elemento `form` dovrebbe contenere solo l'elemento `input`. Rimuovi qualsiasi elemento HTML o testo aggiuntivo all'interno dell'elemento `form`.
```js
assert(
$('form')[0].children.length === 1 &&
$('form')[0].innerText.trim().length === 0
);
```
L'elemento `input` non ha un attributo `name`. Verifica che ci sia uno spazio dopo il nome del tag di apertura e/o che ci siano spazi prima di tutti i nomi degli attributi.
```js
assert($('input')[0].hasAttribute('name'));
```
L'elemento `input` dovrebbe avere un attributo `name` con il valore `catphotourl`. Hai omesso il valore o hai un refuso. Ricorda che i valori degli attributi devono essere circondati da virgolette.
```js
assert(
$('input')[0]
.getAttribute('name')
.match(/^catphotourl$/i)
);
```
Anche se hai impostato l'attributo `name` dell'elemento `input` su `catphotourl`, è sempre raccomandato inserire il valore di un attributo tra virgolette.
```js
assert(!/\<\s*input\s+.*\s*=\s*catphotourl/.test(code));
```
# --seed--
## --seed-contents--
```html
<html>
<body>
<main>
<h1>CatPhotoApp</h1>
<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>
```