User experience is always of the highest concern for any better solution. Input mode plays a pivotal role when it comes to input records/forms in any application. We use only input control in HTML for textbox/forms entry for user input. We enter several kinds of data like plain text, number, decimal, email, mobile number, rich text, search, telephone, URL, date, range etc.

However, a small change in inputmode and type of input control can improve the user experience significantly and ease the typing and entering the data.

In this article, I will explore various inputmode used in HTML for input types like email, text, number, phone number, URL etc. Furthermore, I will illustrate various inputmode for input control with examples and explain how they can improve user experiences and ease the data entry.

Various type of input based on inputmodes and types in HTML are listed below:

  • Default or Text
  • None
  • Number
  • Decimal
  • Email
  • Search
  • Tel
  • URL
  • Date
  • Range
  • Color
  • File

Why do we need various inputmodes and types attribute in HTML input control?

Well, the answer is quite straight forward: To ease the user input and validation. Let me explain in more detail. This attribute inputmode can be extremely useful in mobile keyboards. Adding a small attribute in input controls enhances user experiences by overwriting the keyboard of mobile. Isn’t it cool?

The attribute inputmode=”numeric”, for instance, overwrites the keyboard of mobile with number related keys only as portrayed. 

The above keyboard layout is with inputmode =”numeric”. However, if we don’t use the attribute inputmode and keep it default, then the keyboard layout will be as shown below.

Left (iOS) and Right (Android). This keyboard layout is with default text type.

​Consider a case where the input field requires only numeric input like age or quantity, then adding a simple inputmode numeric can help users with numeric keys only.

Similarly, there are several cases where users need to input emails, telephone number, URL, Date and so on, therefore using inputmode and type attribute can heighten user experiences and ease in entering the values specially with mobile. Furthermore, HTML 5 adds additional validation for those data types.

Let take some examples inputmodes and types in input control.

​Numeric

As shown in the above example, we can use inputmode as numeric for values like age, pin, zip code, credit card number and many similar numeric values.

<input type="text" inputmode="numeric" />

This is one of most commonly used inputmode and further we can add maxlength, minlength, patterns to cover diverse cases.

​In addition to the above, we can add an autocomplete attribute to provide a more accurate keyboard for mobile users. This autocomplete helps users significantly while inserting the records.

Default

We use this inputmode  as Text for default input like string values. We allow users to input any characters.

<input inputmode="text" />

Default keyboard layout is as shown below.

​None

We use none inputmode to show no keyboard. Using inputmode as none, will not show any keyboard at all. We possibly use this sometimes to reset the keyboard.

<input type="text" inputmode="none" />

​​​Tel

This is another handy inputmode for entering a telephone number with Alphanumeric keypad as portrayed.

​Email

This is also the most used inputmode.  These days, we need at least an email in every form entry. Therefore, adding this inputmode can comfort user insertion.

<input type="text" inputmode="email" />

However, adding this inputmode does not change much in the input keyboard, just add @ and . keys.

Decimal

We can add ​a ​decimal inputmode for decimal entry.

<input type=”text” inputmode=”decimal” />

By the way, this mode is like number in Android mobile, however, better experience in iOS comparing to number.

URL

This inputmode is also handy for entering URL in browser or input form because it comes with .com, / keys.

<input type="text" inputmode="url" />

Search

This inputmode adds the go key in iOS and the search key in Android.

<input type="text" inputmode="search" />

Input Type

On the other hand, we can add data types to get richer experience as well as validation like date, file, checkbox, picture, month, time, week and so on. 

Examples:

<input type="date">
<input type="color">
<input type="password">
<input type="radio">
<input type="range">
<input type="text">
<input type="time">
<input type="url">
<input type="week">
<input type="checkbox">
<input type="datetime-local">
<input type="email">
<input type="file">
<input type="hidden">
<input type="image">
<input type="month">
<input type="number">
<input type="reset">
<input type="search">
<input type="submit">
<input type="tel">
<input type="button">

Example of Date Type:

This type will help users to input dates without difficulty.

You can check user inputmode examples from the below site.

https://inputmodes.com/

Conclusion

From above examples, we can, indeed, observe the importance of inputmode and type in input control for better user experience. Based on the requirement of data input, we can use inputmode and type for ease of entering data. A modest change in those attributes results in higher user satisfaction. It is always encouraged to use correct inputmode and data type in HTML input control, which compels users to enter correct data.

References:

  1. https://css-tricks.com/everything-you-ever-wanted-to-know-about-inputmode/
  2. https://css-tricks.com/better-form-inputs-for-better-mobile-user-experiences/

By Rijwan Ansari

Research and Technology Lead | Software Architect | Full Stack .NET Expert | Tech Blogger | Community Speaker | Trainer | YouTuber. Follow me @ https://rijsat.com Md Rijwan Ansari is a high performing and technology consultant with 10 plus years of Software Development and Business Applications implementation using .NET Technologies, SharePoint, Power Platform, Data, AI, Azure and cognitive services. He is also a Microsoft Certified Trainer, C# Corner MVP, Microsoft Certified Data Analyst Associate, Microsoft Certified Azure Data Scientist Associate, CSM, CSPO, MCTS, MCP, with 15+ Microsoft Certifications. He is a research and technology lead in Tech One Global as well as leading Facebook community Cloud Experts Group and SharePoint User Group Nepal. He is a active contributor and speaker in c-sharpcorner.com community, C# Corner MVP and his rank at 20 among 3+ millions members. Additionally, he is knee to learn new technologies, write articles, love to contribute to the open-source community. Visit his blog RIJSAT.COM for extensive articles, courses, news, videos and issues resolution specially for developer and data engineer.

Leave a Reply

Your email address will not be published. Required fields are marked *