Validation form error

Hello, I’ve been doing the challenge “survey form” but I can’t get the validation error to work when i test my code. I’ve tried everything I could find on internet but still not working…
Help please!

Here is the code :

<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<!DOCTYPE html>
<html lang="en">
<h1 id="title">My survey form</h1>
<p id="description"> What is this for?</p>
<form action="process.php" method="POST" id="survey-form">
    <div id="name">
        <label id="name-label">Name</label>
        <input type="text" name="name" placeholder="Enter Name" required>
    </div>
<br>
    <div id="email">
        <label id="email-label">Email</label>
        <input type="email" name="email" placeholder="xyz@someting.com" required>
    </div>
<br>
    <div id="number">
        <label id="number-label">Age</label>
        <input type="number" name="Age" min="12" max="99" placeholder="Enter age" required>
    </div>
<br> 
    <input type="radio" id="Yes" name="Do you like it?" value="Yes">
        <label for="Yes">Yes</label><br>
    <input type="radio" id="No" name="Do you like it?" value="No">
        <label for="No">No</label><br>
    <input type="radio" id="Other" name="Do you like it?" value="Other">
        <label for="Other">Other</label>
<br><br>
<div id="dropdown">
<label for="occupation">Current occupation:</label>
  <select name="occupation" id="occupation">
    <option value="Student">Student</option>
    <option value="Full time job">Full time job</option>
    <option value="Unemployed">Unemployed</option>
    <option value="Other">Other</option>
  </select>
</div>
  <br><br>
        <input type="checkbox" id="What to improve1" name="What to improve1" value="Design">
			<label for="What to improve1"> I don't like the design</label><br>
		<input type="checkbox" id="What to improve2" name="What to improve2" value="Code">
			<label for="What to improve2"> I don't understand the code</label><br>
		<input type="checkbox" id="What to improve3" name="What to improve3" value="Animation">
			<label for="What to improve3"> I don't like animation</label>

    <div>
        <label>Comment</label>
        <textarea name="Comment"></textarea>
    </div>
<br><br>
    <input id="submit" type="submit" name="submit" value="Submit">
    
</form>
</html>

```

The ids, name, email, and number should be on the input elements. Not the parent div element.

Thanks! It did solve the problem but I don’t understand why? isn’t the id just for us? How did it change the code to make the validation error working?

The test is using the ids to get the input elements. If they are not on the correct element it won’t work.

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