De bug donation form

Tell us what’s happening:

Your code so far

I’m doing “debug a donation form” and I feel the test is contradicting itself. 16. You should associate every input element with a label element using the for and is attributes. There are 5 inputs, yet 8. You should have exactly 4 label elements in your form. How can I only have 4 labels and there are 5 inputs and each input has to have a label, it doesn’t make sense and it won’t close. What should  I do?

Lesson URL (copy - paste from your browser’s address bar)

Hi @cortez22,

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 Help button located on the challenge.

The 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.

is maybe the 5th one the Submit input? that one does not require a label, it’s a button, the button has what it means written on top

thanks ill do that, very helpful.

Tell us what’s happening:

hi, it says I need to have a lable for each input,there are 5 inputs, then it says i should have only 4 labels. how do i fix this?

Your code so far

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Donation Form</title>
</head>
<body>
  <h1>Donation Form</h1>
  <form>
    
    
    <label for="text"id="name">Full Name:</label><input type="text" name="name" required>

    
    <label for="email "id="email">Email Address:</label><input type="email" name="email" required>

    
    <label for="number" id ="amount">Donation Amount($):</label><input type="number" name="amount"required>

    <label for ="checkbox" id="newsletter">Subscribe</label><input type="checkbox" name="newsletter" >
    
<label for="submit" id="send">Submit</label>
  <input type="submit" value="Send">
  </form>
</body>
</html>

Your browser information:

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

Challenge Information:

Debug a Donation Form - Debug a Donation Form

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-debug-donation-form/690ddb5e6ee94eb73ed172b0.md at main · freeCodeCamp/freeCodeCamp · GitHub

ive tried to use button, but when i try to check the code itsays again, each input should have a label associated.

Tell us what’s happening:

someone said i should try making the submit a button, i did. it says EVERY input should have a label.

Your code so far

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Donation Form</title>
</head>
<body>
  <h1>Donation Form</h1>
  <form>
    
    
    <label for="text"id="name">Full Name:</label><input type="text" name="name" required>

    
    <label for="email "id="email">Email Address:</label><input type="email" name="email" required>

    
    <label for="number" id ="amount">Donation Amount($):</label><input type="number" name="amount"required>

    <label for ="checkbox" id="newsletter">Subscribe</label><input type="checkbox" name="newsletter" >
    
<button for="submit" id="send">Submit</button>
  <input type="submit" value="Send">
  </form>
</body>
</html>

Your browser information:

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

Challenge Information:

Debug a Donation Form - Debug a Donation Form

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-debug-donation-form/690ddb5e6ee94eb73ed172b0.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @cortez22,

This issue is that you are not associating the label element with the input element correctly.

Please review this user story again, especially the last part.

You should associate each label element with its corresponding input element using the for attribute on the label and a matching id attribute on the input.

Where should the id attribute be placed? Should the for attribute be associated with the input’s type attribute or its id attribute?

Were you asked to add a button element?

Happy coding

I went ahead and merged your topics for you. Please reply to this topic to add any further updates.

this does not help at all. ive read it over and over and as far as im aware its correct.

the the for element within the label should match the type of the input and the id within the lable should match the name. i did that.

no, for on label must match id on input, please review https://www.freecodecamp.org/learn/responsive-web-design-v9/lecture-accessible-tables-forms/why-is-it-important-for-inputs-to-have-an-associated-label