# Build a survey form-Failing Test

**URL:** <https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197>\
**Category:** General\
**Created:** [April 10, 2020, 11:39pm UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197 "2020-04-10T23:39:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mosganda](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mosganda](https://forum.freecodecamp.org/u/mosganda)\
**Post date:** [April 10, 2020, 11:39pm UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/1 "2020-04-10T23:39:44Z")

</div>

**Tell us what’s happening:**  
Currently working on certificate projects (Build a survey form). My code do not seem to be wrong. All test have passed, remaining test 10 which says:  
10. For the name, email, and number input fields inside the form I can see corresponding labels that describe the purpose of each field with the following ids: id=“name-label”, id=“email-label”, and id=“number-label”.  
#name-label is not defined : expected null to not equal null  
AssertionError: #name-label is not defined : expected null to not equal null

**Your code so far**  
This is my code for the test:

```auto
<p>Name:
    <label for="name-label">
      <input id="name" type="text" name="name" placeholder="Enter your name" required>
      <label>
        </p>
    
  <p>Email:
    <label for="email-label">
      <input type="email" id="email" name="email" placeholder="Enter your Email" required/>
    </label></p>
<p>Number:
  <label for="number-label">
    <input type="number" id="number" min="5" max="100" placeholder="Age" required/>
  </label></p>

```

I don’t know it is displaying that label for name is not defined.  
How do i fix this?

**Your browser information:**

**Challenge:** Build a Survey Form

**Link to the challenge:**

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [April 11, 2020, 12:58am UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/2 "2020-04-11T00:58:49Z")

</div>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See [this post](http://www.freecodecamp.com/forum/t/forum-code-formatting/25574) to find the backtick on your keyboard. The “preformatted text” tool in the editor (`</>`) will also add backticks around text.

**Note:** Backticks are not single quotes.

![markdown_Forums](https://sea3.discourse-cdn.com/freecodecamp/uploads/default/original/3X/4/b/4b9a26f0c243380dd84935f4e29b92e3ecee8d05.gif)

* * *

The `for` attribute value on the `label` should match the `id` value on the `input`.

---

<div class="post-metadata">

**Author:** ![mosganda](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mosganda](https://forum.freecodecamp.org/u/mosganda)\
**Post date:** [April 11, 2020, 7:25am UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/3 "2020-04-11T07:25:27Z")

</div>

…  
Thank you Lasjorg for that correction and solution, but the problem is that test(4) wants me to specify label-id as=“label-name” while test (10) wants the input-id to be =“name”. So if i match label id and input id to be the same, one of the test keeps failing.  
…

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [April 11, 2020, 7:31am UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/4 "2020-04-11T07:31:56Z")

</div>

you can’t have multiple elements with the same id, that’s correct

but the `for` attribute of the label should match the `id` of the input element

you have not given an id to your label elements

you are also not using the label elements, you should put the text in the labels, instead of in a paragraph, so that clicking on the text will select the input element

---

<div class="post-metadata">

**Author:** ![mosganda](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mosganda](https://forum.freecodecamp.org/u/mosganda)\
**Post date:** [April 11, 2020, 8:23am UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/5 "2020-04-11T08:23:14Z")

</div>

…

Please the rule below:

...

\*\*User Story #4:\*\* Inside the form element, I am required to enter my name in a field with `id="name"` .

...

\*\*User Story #10:\*\* For the name, email, and number input fields inside the form I can see corresponding labels that describe the purpose of each field with the following ids: `id="name-label"` , `id="email-label"` , and `id="number-label"` .

...

If test 4 pass, test 10 fails and vice-versa due to the different id's. If i use the same id for label and input field, one must fail

...

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [April 11, 2020, 8:48am UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/6 "2020-04-11T08:48:08Z")

</div>

you CANNOT use the same id for two different elements  
it ask to use different id, you are not doing that, one is `id="name"` the other `id="name-label"`

the `for` attribute is not the same as the `id` attribute

also, the label element should contain text

---

<div class="post-metadata">

**Author:** ![mosganda](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mosganda](https://forum.freecodecamp.org/u/mosganda)\
**Post date:** [April 11, 2020, 1:13pm UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/7 "2020-04-11T13:13:50Z")

</div>

```auto
<p>Thanks alot, problem solved</p>

```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [April 11, 2020, 5:43pm UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/8 "2020-04-11T17:43:27Z")

</div>

if you want to get better you can also submit your project for peer review in the #project-feedback subforum

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:59pm UTC](https://forum.freecodecamp.org/t/build-a-survey-form-failing-test/371197/9 "2021-06-01T18:59:45Z")

</div>

Closed on June 1, 2021, 6:59pm UTC


