FAQ: Learn HTML: Form Validation - Requiring an Input

This community-built FAQ covers the “Requiring an Input” exercise from the lesson “Learn HTML: Form Validation”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Introduction to HTML

FAQs on the exercise Requiring an Input

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

2 posts were split to a new topic: Solution was filled in?

How can I style the text error box that pops up after nothing has been entered in the input box.

3 posts were split to a new topic: What is the class attribute?

Hi, I was wondering how I use the required attribute in case I have put in a radio button input, checkbox input, dropdownlist, datalist input etc. Because there are a variety of inputs there.

Thanks in advance.

3 Likes

Hi,
How do we change the text of the validation message popup?
where did it fetch the popup content from as we didn’t enter it as part of the HTML code.

1 Like

Does it matter if the “label element” or the “input element” comes first in writing code? Is their a hierarchy? I keep seeing them interchanged in hierarchical structure. But I also see the “
” tag used too between the 2 elements, and I am wandering if that affects where text is displayed in the output if hierarchy does/doesn’t matter between the 2 elements?

The input box field of this exercise has arrows in it as if the attribute step had been used, but i do not see it in the code and I don’t understand how it shows up. Am I misunderstanding how the arrows are applied to an input? I’ve copied the below:

<form action="check.html" method="GET">
       <label for="guess">Enter a number between 1-10:</label>
       <br>
       <!--Add the min and max attribute to the input-->
       <input type="number" name="guess" id="guess" required min="1" max="10">
       <br>
       <input type="submit" id="submission" value="Submit">
     </form>
1 Like

A post was split to a new topic: What is the answer to the number guesser?

Hello!
I saw in the form the method was “GET” . That seemed new to me at this point. Why is that used ? How is it different from “POST”? or are they the same ?
Thanks in advance