Survey Form - Build a Survey Form

Hello, I can’t seem to get the submit button to work. What am I doing wrong?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="styles.css">
  <meta name="viewport" content="width=device-width initial-scale=1.0">
</head>
<body>
  <h1 id="title">freeCodeCamp Survey Form</h1>
  <p id="description">Thank you for taking the time to help us improve the platform</p>
  <form id="survey-form">
    <fieldset>
    <label for="name" id="name-label">Name <input type="text" required id="name" placeholder="Enter your name"></label>
    <label for="email" id="email-label">Email <input type="email" required placeholder="Enter your email" id="email"><label>
    <label for="numer" id="number-label">Age (optional) <input type="number" id="number" required min="13" max="120" placeholder="Age"></label>
    <label for="dropdown">Which option best describes your current role? <select id="dropdown" placeholder="Select current role" required>
      <option value=""> </option>
      <option value="1">Student</option>
      <option value="2">Full Time Job</option>
      <option value="3">Full Time Learner</option>
      <option value="4">Prefer not to say</option>
      <option value="5">Other</option>
    </select></label>
    <p>Would you recommend freeCodeCamp to a friend?</p>
    <input type="radio" name="where" id="definitely" checked value="definitely"><label for="definitely">Definitely</label>
    <input type="radio" name="where" id="maybe" value="maybe"><label for="maybe">Maybe</label>
    <input type="radio" name="where" id="not-sure" value="not-sure"><label for="not-sure">Not sure</label>
    <p>What would you like to see improved? (Check all that apply)</p>
    <input type="checkbox" id="front" name="front" value="front"><label for="front">Front-end Projects</label>
    <input type="checkbox" id="back" name="back" value="back"><label for="back">Back-end Projects</label>
    <label for="comment">Any comments or suggestions? <textarea id="comment"></label>
  </fieldset>
   <input type="submit" value="Submit" id="submit">
  </form>
  
</body>
</html>

Please post a link to the challenge and explain what you mean by “to work”

My bad, thank you.

Thanks for posting the link.

Just one missing detail. What did you mean earlier when you said you can’t get the submit button to work?

So according to my knowledge, normally my code would be enough for the button to work, yes? But when I was doing the certification project, the website would not accept my code as correct.

I was missing these 3 criterias:

  • You should have an input or button element with an id of submit .
  • Your #submit should have a type of submit .
  • Your #submit should be a descendant of #survey-form .

Which is very weird.

You haven’t closed the textarea element, which causes the rest of your code to be some default text in the textarea. You will be able to see this in the preview. This causes the tests to fail.

Moreover you are not able to see the submit button. Once you fix your code you should be able to see the submit button


There are also some others syntax errors as mentioned below.

I think it is happening because of the syntax errors in the code.
Copy the html to this site and check all the reported errors and try to fix them.

I believe this should help.

2 Likes

Thank you all so much for the help.

2 Likes

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