FAQ: Learn HTML: Form Validation - Checking Text Length

This community-built FAQ covers the “Checking Text Length” 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 Checking Text Length

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

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!

when you sign up for a website where is the data stored

1 Like

in a database most likely

Codecademy runs a webserver (could be nginx), which has an endpoint to which you send your register request, which is then validated (unique username, password long enough, stuff like that), if the data is valid, the data is stored in the database and a response is send to your computer/browser.

In the form element, the method attribute can send data via either POST or GET. But I’m having trouble understanding which one to use and when? I tried to find an answer at w3schools, but just wasn’t getting it. Can someone give me a simple answer with examples?
Cheers,
Mark

1 Like

always use POST for sensitive data (login form, register form and so forth). POST will not display the information in the address/url bar.

get will display the information in the URL bar which means the page can be bookmarked (unlike post), get is useful for searching, lets say you have a search box, then get is a good idea.

4 Likes

Easter egg? ilovecoding

Poking around, I noticed on the login.js that a message will appear (or should) when one enters a username of “codecademy” and a pw of “ilovecoding” however mine did not…

SOOO… what would I need to do to make the exercise index.html run this particular portion of JS (easter egg? :egg::sunflower surprise!)?

Not sure what the problem might be from just that. Mine worked.

I , i’ve been learning here for a while now, and i’m curious where these related stylesheet are from?like this one link href=“https://fonts.googleapis.com/css?family=Fjalla+One” rel=“stylesheet” are they downloaded from google or what?

google has a whole bunch apis and CDNs you can use, these files are fetched from the internet. Although, no doubt some caching is happening

Hello, does anybody know why we are taught to write minlength/ maxlength in text areas, when as min/max is understood and renders the same. Is it a better code? Does it render differently in other browsers if it is not written minlength/maxlength in text areas?

thank you

Hello py

Notice that minlenght/maxlength and min/max serve different purposes.

  1. Minlength and maxlength attributes specify the minimum and maximum number of characters allowed in the element.
  2. Min/max attribute specify the minimum and maximum value (we are talking about cyphers here) for an element.

According to w3schools, “the max and min attributes works with the following input types: number, range, date, datetime, datetime-local, month, time and week.”

Sources:

https://www.w3schools.com/tags/att_input_maxlength.asp
https://www.w3schools.com/tags/att_input_min.asp

When I finished this task, I submitted a username and a password and I received an answer from the form that said " Hurray for client-side validation!". However, I do not see the code that creates this answer in the html file. Where is this code written?

normally the form is send to the back-end (server), where its processed. In this case, that is prevented and JS handles the form (see login.js), there should be a directory/folder icon somewhere which shows you all the files in this exercise

1 Like

You are right! I found the directory and there are 4 files (2 html, 1 CSS and 1 JS called login.js).

You have been of great help. Now I understand a bit more what happens in this code.

I haven’t really done much, you went through the code and improved your own understanding. Nice job :slight_smile:

1 Like

So, that would be an example of server-side verification, and not client-side authentication, correct?

you start with a reference word (that), i can’t deduce what that is referencing. JS runs in the client browser, so JS validation is client side validation.

A slight tangent to the exercise here, but in the element, there is a class=“overlay” attribute. What does this do?

Just FYI, in case it’s not been pointed out, the example code in the label says “Summarize your fillings.” Fine if this is for a dentist’s website… but I assume you meant “feelings.”