Feedback: Survey Form Cert

I passed.

One thing that confuses me is i thought labels had to have a for=“name” that matched a inputs id=“name”. When i put a for=“” in the labels for front-end-projects, back-end-projects and data-visualization it had an X and wanted an id=“” instead.

Can someone help me out so i understand that please?

Do you have a copy of the code that had the for attribute?

<label id="front-end-projects">
<input id="front-end-projects" type="checkbox" value="1"> Front-end Projects</label>
<label id="back-end-projects">
<input id="back-end-projects" type="checkbox" value="2"> Back-End Projects</label>
<label id="data-visualization">
<input id="data-visualization" type="checkbox" value="3"> Data Visualization</label>

this is the specific part where it wanted an id=“” inside the label. Previously we had been taught to put for=“” matching the id=“” of the input it corresponded to. Does that answer your question?

Not sure. The for attribute is something different than the id. You can add a for attribute in the same tag as the id. Just make sure your for attribute is equal to the value of the inputs id.

For example, i took away from this that i needed to give labels a for=“” that match the id=“” of the input tag.

No point in the previous projects did we put an id=“” inside the label. It was always a for=“”.

So i guess my question is, why did the test not require a for=“” inside the label?

step 58 also has us do the for=“” again to match the id=“” but never asks us to put an id=“” in the label. So as of right now i have NO idea why i’d want an id=“” inside my label if i already have a for=“” linking it to the input id=“”

Yes so I think I see what is confusing you. The test doesn’t require a for because, I guess, it simply doesn’t care about accessibility. While the step doesn’t require an id because it doesn’t need that attribute in the label to link the label and the input. The id is needed in the test because the test wants to know if you’ve complied with the requirements to pass you.