Survey Form - Build a Survey Form

Tell us what’s happening:

instructions are unclear whether it should be input id=“name” or if it should be input id=“name-label” or is it asking for label id=“name-label”. I searched online and cannot find anything that says there should be a id applied to label but, that’s what I did with my code. It doesn’t seem to be a problem in the code but, it seems unnecessary. Is it normal to give a label and id?

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
 <head>
    <meta charset="UTF-8">
    <title="Register to Join">
    <link rel="stylesheet" href="styles.css"/>
    </head>
    <body>
      <h1 id="title">Register to Join</h1>
      <p id="description">Register to join the weekend's activities</p>
      <form id="survey-form">
      <label for="name" id="name-label">Name:<input type="text" id="name" placeholder="type your name" required/></label>
      <br>
      <label for="email" id="email-label">Email:<input type="email" id="email" placeholder="enter a valid email" required/></label>
      <br>
      <label for="number" id="number-label">Number<input type="number" id="number" min="0" max="9" placeholder="0"/></label>
        </form>
      </body>
  </html>
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Survey Form - Build a Survey Form

these are the instructions.

The labels are separate elements that get separate ids

According to User Stories 4, 5, 7: the inputs have id: name, email, number.

So name-label, email-label, number-label are id of the labels.

Normally, you don’t have to give an id for label if you need to do so (for example: apply a special style for the label, or an event listener, …)

Please explain to me how:

  1. You should have a form element with an id of survey-form
  2. Inside the form element, you are required to enter your name in an input field that has an id of name and a type of text
  3. Inside the form element, you are required to enter your email in an input field that has an id of email
    and:
  4. For the name, email, and number input fields, you can see corresponding label elements in the form, that describe the purpose of each field with the following ids: id="name-label", id="email-label", and `id=“number-label”
    are not conflicting instructions. Should my id be name, email and number or name-label, email-label and number-label or is it asking me to assign an id to the label? If that is the case then when linking the label and input for each do I still do label for=“name” and input id=“name” or should I be using the name-label for each?

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

I’m not asking about what code to use, I’m asking why these instructions are not conflicting. I haven’t found anything in searching google that indicates that a label should have it’s own id but, it seems like that is what it is asking. Maybe if the instructions were written more clearly, I wouldn’t be here asking this question.

Because the tests need something to “grab for” when testing for each element. The test can only test for elements it knows should exist, it does so by using the required ids.

I merged your threads as it is the same topic.

I think the purposes for the instruction asked to set id for the labels are:

  • Let the learners practice how to set id for elements.

  • For the automatic checking tool to check for labels in the form.

In real life, if you don’t see the necessary, you don’t have to set id for the element.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.