Tell us what’s happening:
Describe your issue in detail here.I have deleted the for attribute from the label element and added a name attribute in the input element. i dont understand where to add the name attribute in the input element and the tip is saying to give the file a name atrribute. this is completely confusing me as i thought my previous code needed a for attribute in the label element
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration Form</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1>Registration Form</h1>
<p>Please fill out this form with the required information</p>
<form method="post" action='https://register-demo.freecodecamp.org'>
<fieldset>
<label>Enter Your First Name: <input id="first-name" name="file" type="text" required /></label>
<label>Enter Your Last Name: <input id="last-name" name="file" type="text" required /></label>
<label for="email">Enter Your Email: <input id="email" name="email" type="email" required /></label>
<label for="new-password">Create a New Password: <input id="new-password" name="new-password" type="password" pattern="[a-z0-5]{8,}" required /></label>
</fieldset>
<fieldset>
<label for="personal-account"><input id="personal-account" type="radio" name="account-type" /> Personal Account</label>
<label for="business-account"><input id="business-account" type="radio" name="account-type" /> Business Account</label>
<label for="terms-and-conditions">
<input id="terms-and-conditions" type="checkbox" required name="terms-and-conditions" /> I accept the <a href="https://www.freecodecamp.org/news/terms-of-service/">terms and conditions</a>
</label>
</fieldset>
<fieldset>
<label for="profile-picture">Upload a profile picture: <input id="profile-picture" type="file"/></label>
<label for="age">Input your age (years): <input id="age" type="number" min="13" max="120" /></label>
<label for="referrer">How did you hear about us?
<select id="referrer" name="referrer">
<option value="">(select one)</option>
<option value="1">freeCodeCamp News</option>
<option value="2">freeCodeCamp YouTube Channel</option>
<option value="3">freeCodeCamp Forum</option>
<option value="4">Other</option>
</select>
</label>
<label for="bio">Provide a bio:
<textarea id ="bio" rows="3" cols="30" placeholder="I like coding on the beach..."></textarea>
</label>
</fieldset>
<input type="submit" value="Submit" />
</form>
</body>
</html>
Attributes for and name are two different things.
The for attribute should be in the label yes.
The name should be wherever they said to put it (usually in an input element or any type of submittable element).
but my input element already has a name attribute so is it possible to add another within the same element, the tip also mentions a file with a name element . do i add this to the input element. the tip has confused me even more.
I already have a name attribute in the input element “first name”. and the tip mentions a file with a name attribute so i am lost as to how to add another name attribute
I have done this but i already have a name attribute in the input element so even when i change the value is it still incorrect, also i mentioned the tip says something about a file with a name attribute, where did this come from?.
I have wrote unique. It is important.
I think you should take a break and back to this later on. You will see the issue right away. Trust me.
All label elements should have for attribute too.
Just check all code and read the challenge again later on.
Happy coding!
My advice Matty is you should reset the challenge and start over, reading everything: code, challenge description and our answers. Don’t be afraid of try again. You nearly did it.
reading and coding out loud it helps some times when we are too focus in some solution (it happens to everyone) and in the learning process as well.
Just give you 5 min break, trust me, and read again carefully
Focus where <label for="profile-picture line is. You need to add a name. Then it will prompt you to the line where age is then Provide a bio:. The question says “file” and the only time the file is repeated on the output where it asks you “Browse”. You need to find the corresponding code to that display. My code has passed. You can repeat names for “name” attribute. Let me know!
You don’t need to delete the for attribute cos it links to the input id. Add the name attribute in the input just like you did with the Id. You can give it any name