Responsive design servey form

Tell us what’s happening:
I am facing difficulty in survey form creation and don’t know how to add html5 validation errorplease help me with this!!

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36.

Challenge: Build a Survey Form

Link to the challenge:

1 Like

Hi @BhargaviSheth. Please provide the CodePen URL. That makes us help you even better.

What did you not understand when you searched for “html5 validation error”?

Have a look at the type attribute for input elements (for example type="email")

Hey @BhargaviSheth, even though you didn’t provide any link to the project, I will show you how you can add validation errors.

  • For the email input validation error, put the type attribute of the email input to email and the browser will automatically show a validation error if anyone entered an invalid email. Take a look into the link @lasjorg gave.
  • For the number field, you need to put the number input field’s type value to number. Then, you can add a min attribute and max attribute and enter your preferred minimum and maximum values in it. Now, if someone enters an invalid number, the browser will show a validation error.

In the future, if you don’t understand how to do things like this, you can look into the code of the example project freeCodeCamp gives and see how they did it. Also, googling is a great point when you’re stuck.

Happy Coding!