Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use amazeui Framework to realize Page check function in html5

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to use the amazeui framework to achieve page verification function in html5", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use the amazeui framework in html5 to achieve page verification function" article.

The postal "zip code" field, in the database is varchar2 (10).

However, in amazeui's page verification, the character length is checked in the following ways:

JS form validation

JS form validation is based on various validation properties of HTML5:

Required: required

Pattern: validates regular expressions. Plug-ins have built-in regular expressions of email, url, and number.

Minlength/maxlength: character limit

Min/max: minimum and maximum limits, applicable only to fields of numeric types

Minchecked/maxchecked: at least, up to the number of selections, applicable to checkbox and drop-down checkboxes. When checkbox, set the relevant attributes on the first element of the same group.

.js-pattern-xx: verification rule class. Rules that exist in the regular library can be added by adding corresponding class.

Note:

In HTML5 native form validation, pattern only validates the validity of the value, that is, it can be left unfilled, and if it is filled in, it must comply with the rules. If it is required, still add the required attribute. The plug-in is consistent with the rules of HTML5.

That is, maxlength=10,amazeui means that you can enter 10 words (numbers, letters and Chinese characters are treated as one word)

But if the previous paragraph entered 10 Chinese characters "medium", the length of the database must be overflowed after submission, because the length of the database of this field is varchar2 (10), that is, 10byte can only store 3.3333 less than 4 Chinese characters (because a Chinese character if GBKGB2312 code occupies 2 bytes, but unicodeutf-8 code accounts for 3 bytes).

So only maxlength=10 can not correctly restrict input, but also add the restriction of js-pattern-number (this ensures that the input is an integer, so that Chinese characters cannot be entered).

The above is about the content of this article on "how to use amazeui framework to achieve page verification function in html5". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report