FAQ: Learn HTML: Forms - Password Input

This community-built FAQ covers the “Password Input” exercise from the lesson “Learn HTML: Forms”.

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

Introduction to HTML

FAQs on the exercise Password Input

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!

Is there a way to chose between * or • displayed on the input box when writing?

4 Likes

In this exercise we have seen how to hide on our screen the input password. By the way after the commit of the form password will be sended as plain text. If I want to encrypt it , how can I do ?

Why must there be a “name” and “for” attribute? Can’t the code work without them?

use https (s is for secure, it uses ssl encryption with certificates)

for associates a label with an input element. This is needed for people who use disability tools.

name is used to associate the input field with the data send to the server.

3 Likes

What difference are there between name and id attribute?

2 Likes

the for attribute uses the id to associate input field and label, the id also can be used for styling

In the explanation of Adding a Label, we found <input type=“text” name=“x” id=“x”>. In the explanation of Password Input, we found <input type=“password” id=“x” name=“x”>. While in “Number Input,” we found <input id=“x” name=“x” type=“number” step=“x”>

My question is, why in Adding a Label, the name attribute comes before the id attribute, different from in Password Input which the name attribute comes after the id attribute and also their structure of the use type, name, id different from the Number Input structure?

Structurally, is it that way? Thanks!

1 Like

attribute order is irrelevant, you could use any order you like

1 Like

Hi,
Although I understand that the attribute order is irrelevant in terms of execution order and rendering on the HTML page. Yet in previous lessons we are taught about readability of the code and common practice. Surely there is some guideline on the order of attributes ? Or at least an order to agree on.
Type / Name / ID / etc ?

Thank you for any extra clarification.

yes, unfortunately, there is no guidance, so you choice your own order if you work alone, or choice an order for the attributes when working in a team and then sticking to them

Do “id”, “name” and “for” attributes require the same name ?

id and for should have the same name, given this associates the label with the input element. name doesn’t have to be the same, but i quite often do, because you want to have a logic name (one that make sense for the input field)

1 Like

Why is it that from exercise 5 onwards the form-tag in the explanation screen on the left no longer has the attributes action="/example.html" and method=“POST”>?

What happens if we omit the attribute “for” in label tag.Does it makes any difference?

the for attribute associates the label with the input element, omitting could cause problems for disability aid tools for example.

After reading through the comments I understand the the attributes and values perfectly fine, as well as per the comments that the order does not matter, why doesn’t the lesson make this clear and marks us wrong if we follow the example to put “type / id / name” in that order instead of the “id / type / name”?

order of attributes is not relevant. However, being consisted within one project is better practice.

Why should the value in name attribute of input should match the value of for attribute of label?
I can understand for(of label) should match with id(of input).
It works just fine when name does not match with for. Why does the exercise insist on both values being the same?

the name attribute doesn’t have too match the for attribute, yet very often these names are the same. Why? Because its the most logic/descriptive name available.