Learn HTML Forms by Building a Registration Form - Step 29

Tell us what’s happening:
Describe your issue in detail here.
I have added the respective personal-account , business-account , and terms-and-conditions as values for the respective id attributes and the error is saying that the first label element should have a for attribute with a value of personal-account , but there was no direction to add that. Here are the instructions for this step:

Step 29

Follow accessibility best practices by linking the input elements and the label elements in the second fieldset.

Use personal-account, business-account, and terms-and-conditions as values for the respective id attributes.

What am I misunderstanding?
Thank you
Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Registration Form</title>
    <link rel="stylesheet" href="styles.css" />
    <h1>Registration Form</h1>
    <p>Please fill out this form with the required information</p>
    <form method="post" action='https://register-demo.freecodecamp.org'>
        <label for="first-name">Enter Your First Name: <input id="first-name" type="text" required /></label>
        <label for="last-name">Enter Your Last Name: <input id="last-name" type="text" required /></label>
        <label for="email">Enter Your Email: <input id="email" type="email" required /></label>
        <label for="new-password">Create a New Password: <input id="new-password" type="password" pattern="[a-z0-5]{8,}" required /></label>

<!-- User Editable Region -->

        <label><input type="radio" name="account-type" id="personal-account"/> Personal Account</label>
        <label><input type="radio" name="account-type" id="business-account"/> Business Account</label>
        <label><input type="checkbox" required id="terms-and-conditions"/> I accept the terms and conditions</label>

<!-- User Editable Region -->

      <input type="submit" value="Submit" />
/* file: styles.css */
body {
  width: 100%;
  height: 100vh;
  margin: 0;
  background-color: #1b1b32;
  color: #f5f6f7;

label {
  display: block;
  margin: 0.5rem 0;

Your browser information:

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

Challenge: Learn HTML Forms by Building a Registration Form - Step 29

Link to the challenge:

1 Like

You have added the ‘id’ attribute in the input elements, but you forgot to add the ‘for’ attribute in the opening <label> tags. For each pair of label-input element you should have the same value in the corresponding attributes.

1 Like

This doesnt answer my question. As I have understood the instructions, I have done what the prompt has asked of me. It does not say to add a for attribute. So again, what am I misunderstanding?

Thank you

1 Like

The instruction: " Follow accessibility best practices BY LINKING the input elements and the label elements in the second fieldset ."

This is an example from the code you posted here:

<label for="first-name">Enter Your First Name: <input id="first-name" type="text" required /></label>

As you can see, the ‘for’ and ‘id’ attributes have the same values.


slow clap for the capitalized words there but if you could please explain in more detail as I am obviously having trouble understanding. All i am gleaning from this is that ANY TIME i see the word LINKING, it means to add a for attribute somewhere. If thats true, thats fine, i will make a note but please be patient as I am a beginner and I was under the impression that this course was friendly to beginners, although that is not what i have felt so far. So, is that what i am misunderstanding?


I didn’t mean to be rude. It was just the easiest way to emphasize the part of the instruction.

The for= attribute in the label is used to link the label to one specific input on the page, which is defined by its ‘id’ attribute.

When you should add the ‘for’ attribute depends solely on the concrete challenge in this course. Later, in real projects, you will probably use this principle of connecting for and id attributes as a rule.


Okay so to be clear, anytime i see the prompt to “link” something, that always means i need to add a for=attribute into the label element (which also means there would never be a prompt to link anything without a label element present)?

1 Like

This is a snippet from your code. You see this rule in practice. However, some steps in this course may divide the task into smaller parts, by giving you instructions to, let’s say, nest an ‘input’ element within the ‘label’ element, and then in the next step, to add the ‘for’ and ‘id’ attributes.

1 Like

So I fully recognize that i have used the for attribute before. However, in those steps, I am asked to do so specifically. What I am trying grasp conceptually is how to know that the for attribute is what the prompt is requiring when it just asks to link things as linking is used in many ways to describe an action. Therefore, assuming that that is what I am being asked to do whenever i see the word “link” would not be prudent. So if LINKING is not the operative word to indicate that the only response should be the for attribute, than how can i be sure which attribute to use where, given the instructions for the step?

All your response does is say, look youve used it before and sometimes the steps ask you to do it in multiple steps, which does not answer my question about how I would be confident in what the prompt is asking of me.

I can see what you are saying, I am looking for the why of it. This is a more conceptual question as I am trying to glean a more comprehensive understanding of this. If there is anyone else that would want to respond with an explanation, that would be much appreciated.

1 Like

How do I get responses from other people?

1 Like

If you want some conceptual explanation, post your question in the “General” or “freeCodeCamp Support” forum.

1 Like

This phrase means “use for attribues for the labels with matching id attributes for the input elements”.

1 Like

okay so just to clarify, anytime i am asked to “link input and label elements”, it could ONLY mean that I need to add a for attribute into the label element that matches the id attribute in the input element?

1 Like

This is the Step where this was previously covered:

In this context link and associate mean the same thing.

1 Like

okay in that step it says that there are more than one way to associate the input element text with the element itself. this is where my confusion comes from. if there are multiple ways to do this, how would i know exactly what the prompt is asking me by just saying to “follow accessibility best practices”? the step you linked doesnt say anything emphatic about any best practices or which one would be best or correct. im just confused as to why i should have gone directly to a for attribute from that prompt. i am just a beginner and i promise i am trying to understand this and the bigger concepts at play here but the wording of the prompts seem to assume that readers already have a conceptual understanding of some of these ideas and i just dont. maybe it would be helpful to have certain words linked to another page that discusses the concepts behind linking or associating , best practices etc…

1 Like

a multiple sentence reply would be very helpful.

1 Like


okay so first, arent the input elements nested inside the label elements in this example already?
and if so, why would you need the for attribute?

also, in what scenario would it not be practical to just nest the elements?

1 Like

Professional developers are donating thousands of dollars of free tutoring every day on this forum. We’re trying to answer your questions. Sometimes it takes a bit of back and forth for understanding to be reached.

Technically my last reply contained two sentences, so that meets your “multiple sentence reply” requirement, fwiw. :wink:

There is a lot of material and sometimes it takes a while to synthesize the knowledge.

This is the first Step where you linked a label and an input.
Here the label and input are associated via nesting.

Then this alternative way to associate labels and inputs with for and id attributes was introduced.

This step talks about how this second approach is an accessibility best practice.

That language about accessibility is repeated on this step you are working on.

So, to answer this, you would need to remember the previous 3 steps discussing this, specifically the previous step on this particular project that called this approach an accessibility best practice.

It was mentioned in step 18, but if you don’t remember that language, then you get a hint telling you exactly this.

And index is on the to-do list but its a very full list.

1 Like

Thank you all for the thoughtful responses. I promise I am trying my hardest and I really appreciate all the help. Im still going through all of the responses now but I think these set me up for success.

thanks again


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