Home > WeChat Applet > Mini Program Development > How to automatically clear the content after submitting the form in the mini program

How to automatically clear the content after submitting the form in the mini program

王林
Release: 2021-03-09 09:26:55
forward
4425 people have browsed it

How to automatically clear the content after submitting the form in the mini program

Purpose: After the WeChat applet is submitted, the form content will be automatically cleared.

Idea analysis:

We can clear it through value binding, but this method will become very troublesome when there is a lot of form data.

Solution:

The form uses the bindreset event to submit data instead of the bindsubmit event, so that the form content will be automatically cleared after clicking submit.

But this will bring a new problem:

Using bindreset cannot obtain form data from the event parameter e.detail.value.name

(Learning video sharing: php video tutorial)

Therefore, it is necessary to obtain the content in the form binding event, such as

<input bindinput="inputText"/>

inputText: function(e) {
    this.data.quesText=e.detail.value
}
Copy after login

Related recommendations: 小program development tutorial

The above is the detailed content of How to automatically clear the content after submitting the form in the mini program. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template