Mini Program writes a form submission, and every input out of focus uses js to verify the input information, so do you have to re-verify the information of each input box when you click the final submit button?

every input originally has a blur event to validate user input. Do you want to revalidate these input boxes when you click the final submit button? In the past, when I wrote in jquery, I asked for ajax when I set a flag, point submit button for each input to verify that their flag was true. Mini Program feels that it is troublesome to add a lot of variables to data according to jquery. Is there a good way?


sure, in case the user comes in and submits it directly, so it's best to write a method for each verification so that it can be handled when it is finally submitted.

<input placeholder="" bindblur="checkName"/>
<input placeholder="" bindblur="checkPassword"/>
Page({
  data: {
    name: ''
    password: ''
  },
  checkName: function (e) {
    if () {
      return false
    }
    return true
  },
  checkPassword: function (e) {
    if () {
      return false
    }
    return true
  },
  submit: function () {
    if (!this.checkName) return
    if (!this.checkPassword) return
  }
})

must be verified when you click. You can piece together a method and call


to write a form for verification with the status mode yourself. Adjust the interface


JQuery is a JavaScript-based library that makes using JavaScript much easier for your web-based applications. when all are passed. JQuery is fast much easy to use small in size and provides a lot of features. I have heard of JQuery but don't understand how does work it. Essay Writing Services UK

Menu