Skip to content

JavaScript Validations

cgebken edited this page Nov 9, 2020 · 2 revisions

If you are using a JavaScript validation tool such as the jQuery Validation Plugin (recommended), you can use the input__error error class for applying the same styles that are used in the BeyondCanvas::FormBuilder. When doing so, you should also call the hideSpinner() and enableActionElements() functions. In case of failure, they will restore the buttons to their defaults.

Here's an example of a validation with the jQuery Validation Plugin:

$('#myform').validate({
  errorClass: 'input__error',
  invalidHandler: function () {
    $.restoreActionElements();
  }
});