Create a Form Element, help

Tell us what’s happening:
I have had 2 people try to explain this to me but i just cant get past it, can someone please just type me what i need to code to get past this and continue my progress. I have been stuck here all morning.

Your code so far


<h2>CatPhotoApp</h2>
<main>
  <p>Click here to view more <a href="#">cat photos</a>.</p>
  
  <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
  
  <p>Things cats love:</p>
  <ul>
    <li>cat nip</li>
    <li>laser pointers</li>
    <li>lasagna</li>
  </ul>
  <p>Top 3 things cats hate:</p>
  <ol>
    <li>flea treatment</li>
    <li>thunder</li>
    <li>other cats</li>

  <form action="/submit-cat-photo"></form>
<main>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-html-and-html5/create-a-form-element/

1 Like

So you’re REPLACING the input field with a form element. The test is asking you to NEST the input field WITHIN a form element.

See how all the <li> tags are nested in the <ul> opening and closing tags? That’s what they mean by nested. That element resides within its parent element. So put the input element inside the form element, between the opening <form> tag and the closing </form> tag.

so would i put inside of a ?

<input action="/submit-cat-photo">

inside of a <form> ?

So revert to the original code of the page (use the Reset all Code button). Now, you’ll see an input at the bottom of the HTML editor. That input should be wrapped with <form> and </form>.

The form element becomes the PARENT element of the text input. The text input is the CHILD element of the form, being nested (or contained) by it.

im so confused then, what about the submit-cat-photo, part

So the form element has an attribute, action, with the value submit-cat-photo. When you create those form elements, simply put any attributes in the OPENING (the first) tag. So, without giving you everything, you now have something like:

<form>
  <input type="text" placeholder="cat photo url" >
</form>

The input above has two attributes: type and placeholder. You want to add one attribute to form: action.

oh so you just add action="submit-cat-photo" . to that center line of code?

You add THAT line inside the <form> tag. The first line in my sample.

inputs don’t have actions. Generally, they don’t do stuff, they don’t go places, they don’t really have a life.

Forms, now… forms get out and about. They do things. They talk to servers and stuff. So forms have actions. :wink:

oh my gosh, so close. I am missing the middle check mark now. I have been working on this one part all day, i really appreciate the help.

I GOT IT, thank god. That took so long:joy::sob: thank you so much