In magento1 we can check validation like this:

var formToValidate = $('form-validate');
    var validator = new Validation(formToValidate);
    if(validator.validate()) {
        // Here we can code after validation.

but in magento2 i want to check all validation but don't want to submit form after success. so how can I perform with magento2 form?

2 Answers 2


Try this:

require(["jquery"], function ($) {
    $(document).ready(function () {
        $('#my-button-name').click(function () { // The button type should be "button" and not submit
            if ($('#form-name').valid()) {
                alert("Validation pass");
                return false;

Hope this helps!


You can use solution where you have data-mage-init validation

    ], function($){
        $(".MYbuttonClass").on("click", function() {
           if ( $('.form-Class').validation() && $('.form-Class').validation('isValid') === true) {
                //Submit form    



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.