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

王林
王林forward
2021-03-09 09:26:554423browse

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
}

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete