In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to realize the form verification function of WeChat Mini Programs". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought slowly and deeply. Let's study and learn "WeChat Mini Programs how to achieve form verification function"!
Wxml
Ladies and gentlemen, the submission is being submitted.
App.js
Import wxValidate from 'utils/wxValidate'App ({wxValidate: (rules, messages) = > new wxValidate (rules, messages)})
News.js
Var appInstance = getApp () / / form validation initialization onLoad: function () {this.WxValidate = appInstance.WxValidate ({name: {required: true, minlength: 2, maxlength: 10,}, mobile: {required: true, tel: true,}, company: {required: true Minlength: 2, maxlength: 100,}, client: {required: true, minlength: 2, maxlength: 100,}}, {name: {required: 'please fill in your name',} Mobile: {required: 'Please fill in your mobile phone number',}, company: {required: 'please enter a company name',}, client: {required: 'please enter a bound customer',}})} / / form submission formSubmit: function (e) {/ / submit error description if (! this.WxValidate.checkForm (e)) {const error = this.WxValidate.errorList [0] / `${error.param}: ${error.msg}` wx.showToast ({title: `${error.msg}`, image:'/ pages/images/error.png' Duration: 2000}) return false} this.setData ({submitHidden: false}) var that = this / / submit wx.request ({url:'', data: {Realname: e.detail.value.name, Gender: e.detail.value.gender, Mobile: e.detail.value.mobile, Company: e.detail.value.company Client: e.detail.value.client, Identity: appInstance.userState.identity}, method: 'POST', success: function (requestRes) {that.setData ({submitHidden: true}) appInstance.userState.status = 0 wx.navigateBack ({delta: 1})}, fail: function () {} Complete: function () {}})} Thank you for your reading The above is the content of "how to achieve the form verification function of WeChat Mini Programs". After the study of this article, I believe you have a deeper understanding of how WeChat Mini Programs realizes the form verification function. The specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.