Home > WeChat Applet > Mini Program Development > How to obtain multiple formIds by clicking on WeChat applet

How to obtain multiple formIds by clicking on WeChat applet

angryTom
Release: 2020-03-16 10:52:19
forward
3393 people have browsed it

This article introduces the method of obtaining multiple formids by clicking on a WeChat applet. I hope it will be helpful to friends who are learning the development of WeChat applet!

How to obtain multiple formIds by clicking on WeChat applet

How to get multiple formIds by clicking on WeChat mini program

How to get multiple formIds in WeChat mini program, solve the problem of mini program Click once to submit multiple form questions. As long as you click the login button, you can submit the form once and get the formId once. However, it seems that it is not possible to achieve multiple submissions with one click.

The key points of the WeChat applet method of obtaining multiple formIds are the problems encountered and the process of solving them.

Recommended learning: navicat tutorial

Requirements: Click once on the WeChat applet to submit multiple forms. In fact, there are business requirements. I won’t write it clearly here. Just do Students who have come to this point will naturally understand that

Just like the above few lines of code, as long as you click the login button, you can submit the form once and get the formId once. However, if you want to click once and submit multiple times, just click Copying these lines of code doesn't seem to work, either by shrinking the button or some other weird ways.

What I want to talk about here is a click penetration method

I wrote a view inside (inside the button)

Let me show you the style (the style is very important)

      .btn{
        width: 20rpx;
        height: 20rpx;
        margin: 0;
        padding: 0;
        border-radius: 0;
        position: fixed;
        background: rgba(0,155,0,0.5);
        top: 0;
      }
      button::after{
        border:none;
      }
      .aa{
        width: 200rpx;
        height: 200rpx;
        background: rgba(0,155,0,0.5);
        position:fixed;
        top: 0;
      }再看一下js,顺便说一下,模拟器上看不到实际的formId,用手机调试模式可以看到
      formSubmit: function(e) {
          if (e.detail.formId != \'the formId is a mock one\') {
              this.setData({
                  formIdString: e.detail.formId + , + this.data.formIdString
              })
          }
          console.log(this.data.formIdString)
      },
Copy after login

What you see is this. When you click on any green area, you can click on the button and then submit the form.

How to obtain multiple formIds by clicking on WeChat applet

Put the entire wxml code Copy it and put it in the view. It looks similar to before. In fact, it is stacked.

How to obtain multiple formIds by clicking on WeChat applet

However, in actual operation, if you click on the green part, it will be submitted twice. Click on the red part. It will only be submitted once, why is this, look at the picture first

How to obtain multiple formIds by clicking on WeChat applet

If you want more formId, you need more copy and paste, which is not available yet. Think of good solutions.

Recommended learning: Small program development

The above is the detailed content of How to obtain multiple formIds by clicking on WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:zixun.jisuapp.cn
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