Build HTML Forms The Right Way βœ…

The dos and don'ts of UX for HTML forms + some JS 😁

πŸ§΅πŸ‘‡
1. Request as little as possible πŸ‘

Entering more data than necessary is annoying and that's a fact.

If you really only need an email, consider not asking for first name, last name, and phone number.

Smaller forms == higher conversion rates.
2. KISS = Keep It Simple S... πŸ˜…

By sticking to simple designs that use standard input types, you're creating a more cohesive experience, not only across your site but across the internet.

Users are less likely to get confused by some fancy & novel input. Stick to the classics.
3. Semantics Are Good for a11y & UX πŸ™Œ

Choosing the right input types improves the experience on many levels: semantics, accessibility, & UX.

Folks are used to the way inputs work across the web, so we can take advantage of that by using the same inputs for the same things.
4. Put Country Selector Before City/State πŸ—Ί

If you're going to ask for a user’s country, put that before the city and state fields.

By putting the country first, you maintain the flow of the form, which is especially nice for users that use the keyboard to navigate.
5. Paginate Long Forms 1️⃣2️⃣3️⃣

Ideally, you shouldn't have too much data. However, in some cases, it cannot be helped.

It might make sense to paginate a form so that the information is not overwhelming. A good practice is to show the user some sort of UI about their progress.
6. General rule: Prevent Browser Refresh πŸ₯΅

Have you ever been filling out a long-form & accidentally refreshed the page, losing all your work? It’s the worst

The browser provides us with the "beforeunload" event. We can use it to inform the user they're about to lose any work.
7. General rule: Store Unsaved Changes πŸ’Ύ

Along the same lines as the previous point, there are times when we accidentally lose all our work on a long form. Fortunately, we can avoid causing this grief to our users by taking advantage of browser features like "sessionStorage".
8. Input Functionality: inputmode ⌨

inputmode is an HTML input attribute that lets you tell the browser the input format. This may not be immediately clear, and if you are on your desktop computer then you won’t notice it, but for mobile users, it makes a huge difference.
9. Input Functionality: autocomplete 😎

The autocomplete attribute is another built-in feature.

Many websites use forms to request info from users. A nice feature is the ability for users to save their own information so that it can be auto-completed across different forms.
10. Input Functionality: autofocus πŸ™ƒ

The last built-in attribute I’ll mention is autofocus. By adding it to an input, the browser will place focus on an input, select, or text area (Chrome also supports using it on <button>, <a>, and elements with tabindex).
11. Auto-expanding textarea ✍

A textarea that automatically expands to match the content in it is much appreciated!

That way you don’t have to deal with text areas that are huge, or those that are too small and need a scrollbar to get around.
12. Disable Scroll Event on Number Inputs πŸ“

If you're not familiar, there is a browser feature on number inputs that allows you to increment or decrement the value using a mouse wheel.

This can be a nice feature if you need to quickly change the value and do not want to type.
13. Validation: Delay Validation to Blur or Submit Events βœ…

With HTML5, it’s easy enough to add some client-side validation to your forms. You may decide to enhance it with some JavaScript as well, but when you choose to validate inputs matters.
14. Validation: Don’t Hide Validation Criteria πŸ€“

Clearly tell users upfront what makes an input valid or invalid.

By sharing that information, they already know that their πŸ†• password needs to be 8 char long, contain upper & lowercase letters, & include special characters.
15. Validation: Send All Server Validation Errors Back at OnceπŸ‘€

Another annoying experience-> having to resubmit the form multiple times.

It can happen b/s the server validates 1 field at a time & returns the errors immediately, or b/s an input has multiple validation criteria
16. Submissions: Submit With JavaScript πŸ’»

Regardless of how you feel about the explosion of JS into every part of our lives, there is no denying that it's a useful tool to make UX better.

Rather than waiting for the browser to submit the form, use JS & avoid a page reload.
17. Submissions: Including Status Indicators πŸ‘©β€πŸ’»

This tip ties in very closely with the previous one. If we are going to be submitting forms with JavaScript, we need to be updating the user on the status of their submission.
18. Submissions: Scroll to Errors πŸ’Ό

In the event that your form does, it’s best to let the user know exactly what went wrong & where.

Especially on long scrolling pages...

JS can help us out here by searching for the 1st invalid input element in the form & focusing on it.
Are you still here?! Wow, thanks! πŸ€©πŸŽ‰

You can find forms pretty much everywhere.
Observe what works and what doesn't, then, code accordingly. πŸ˜‰

What tips would you add?

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Eleftheria Batsou

Eleftheria Batsou Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @BatsouElef

20 Oct
HTML: Did you know all these things belong to the <head>?

πŸ§΅πŸ‘‡ A thread
[1] But first what is the "HEAD"? πŸ‘©β€πŸ”¬

The head of an HTML document is the part that is not displayed in the web browser when the page is loaded.

It contains information such as the page <title>, links to CSS, links to custom favicons, and other metadata.
[2] Ok, another unknown word: "METADATA", what is this? 🧱

METADATA = data about the HTML.

These are things such as the author, and important keywords that describe the document, etc.
Read 12 tweets
18 Oct
Before you deliver your CSS code make sure you have completed these 12 things. πŸ§΅πŸ‘‡
[1/12] Responsive Web Design πŸ“±

Does your website use a responsive web design?

If not, fix your CSS!

If you don't know what Responsive Web Design is, check out this article by @tmoulos

growthrocks.com/blog/responsiv…
[2/12] Unique ID πŸ‘€

Check if all of the IDs are used and if they are unique to a page.
Read 14 tweets
16 Oct
7 Skills needed to be a front-end developer | For Juniors πŸ™Œ

πŸ§΅πŸ‘‡
It’s possible to become a front-end developer without a college degree, provided you acquire the right skills. πŸŽ“

In this thread, I'm sharing my view of the top 7 technical skills a front-end developer must possess.

Let's go. πŸ‘‡
[1/7] Learn HTML and CSS 🦴

Hypertext markup language (HTML) and cascading style sheets (CSS) are a website’s skeleton.

While HTML gives structure to web pages, CSS helps style the HTML elements with the color, fonts, typeface, and more.
Read 12 tweets
27 Sep
17+ JavaScript Resourses

[A thread 🧡- Books, Courses, Tutorials, etc. ⬇]
[1/17] MDN JavaScript Guide

developer.mozilla.org/en-US/docs/Web…
[2/17] JavaScript For Cats πŸ“š
An introduction for new programmers

jsforcats.com
Read 19 tweets
26 Sep
5 UI/UX mistakes I found (without even searching) in 10 websites in 15 minutes. πŸ‘‡

[Check it, unintentionally you might have the same issues in your website]
[1/5] I can't copy the text.
Make your text "clickable". I may want to copy your email 😎
[2/5] Social media links don't work 😲
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(