Validate before form submission in EasyUI

  • 2021-07-04 17:55:28
  • OfStack

With EasyUi, we can verify before the client form is submitted. The process is as follows: only use return $("# form1"). form ('validate') method when onSubmit, and from ('validate') method in form module in EasyUi will verify the elements that need to be verified, such as required=true in the form we specify by itself, but return 1 false when there are failed elements;


$("#form1").form({
url: 'login.ashx',
onSubmit: function () {
// Form validation 
return $("#form1").form('validate')
},
success: function (data) {
alert(data)
}
}
);

Related articles: