Instance code for EasyUI validation before form submission

  • 2021-06-29 10:21:58
  • OfStack

With EasyUi, we can validate the client form before submitting it. The process is as follows: Simply use the return $("#form1"). form ('validate') method when onSubmit, the from ('validate') method in the form module in EasyUi will validate the elements that need validation such as required=true in our specified form by itself, but sometimes return an false if they fail;


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

Related articles: