Home Daily Programming HTML Knowledge How to use form components in Mip

How to use form components in Mip

Nov 05, 2018 pm 04:45 PM
form component

This article mainly introduces how to use the form component in MIP.

Mip is a mobile web accelerator. In the previous article, I have introduced you to several commonly used components in MIP, such as Carousel component and Inline frame component, Collapse menu component, App promotion download component, etc.

Recommended reference manual: "MIP Documentation Manual"

This section will continue to introduce the use of form components.

Form component (mip-form form, Form submission) basic code example is as follows:

<mip-form method="get" url="http://www.php.cn?we=123">
    <input type="text" name="username" validatetarget="username" validatetype="must" placeholder="姓名">
    <div target="username">姓名不能为空</div>
    <input type="number" name="age" validatetarget="age" validatetype="must" placeholder="年龄">
    <div target="age">年龄不能为空</div>
    <input type="submit" value="提交">
</mip-form>
Copy after login

Note, required Introduce the following script into the mip file body.

<script src="https://c.mipcdn.com/static/v1/mip-form/mip-form.js"> </script>
Copy after login

Access through the browser, the effect is as follows:

How to use form components in Mip

When we click submit when it is empty, the prompt in the picture above appears.

Among them, some important attributes are introduced:

method: Indicates the form submission method. If the form submission method is post, an HTTPS address should be used.

url: Must be an address starting with HTTP(S) or //

validatetarget: Indicates the verification prompt corresponding to the tag, use Search for the prompt display element when corresponding to an error

validatetype: Indicates the validation type, used to support simple validation. Currently email, phone, idcar, custom are provided. When it is custom, you need to fill in validatereg
Required options: No

validatereg: Indicates custom verification and supplements the webmaster's personalized verification rules. If validatetype is custom, you need to fill in the corresponding validation rules

clear: Indicates the clear button switch in the form

fetch-url: With this attribute, you can enable asynchronous request data logic. The component will refresh local information according to the template in the submit-success and submit-error blocks based on the data return status.

This article is an introduction to the basic use of form components in MIP. It is simple and easy to learn. I hope it will be helpful to friends in need!

The above is the detailed content of How to use form components in Mip. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)