Click here to Skip to main content
15,882,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
iam useing to validate my form in and it work fine, i am trying to use blockui to block the page on long process but it fire up when button submit before form validate and keep page blocked. how to validate form first then block page while saving

    $(document).ready(function () {
            framework: 'bootstrap',
            icon: {
                valid: 'fa fa-check',
                invalid: 'fa fa-times',
                validating: 'fa fa-refresh'
            fields: {
               <%=txtName.UniqueID %>: {
                row: '.col-md-4',
                    validators: {
                        notEmpty: {
                            message: 'Name is required'

$(function (e) {
        $('#<%= btnSave.ClientID %>').click(function () {

            if ($('#form1').validate()) {
                    message: '<h5><img src="img/loading.gif" />Loading </h5>',

What I have tried:

i tried blockui with jquery validation and work fine but i want to use it with The best jQuery validation plugin to validate form fields, support Bootstrap, Foundation, Pure, SemanticUI, UIKit frameworks - FormValidation[^]
Updated 23-Apr-17 11:36am

1 solution

You can make your form model (blocking) quite easily by placing a transparent div at a Z-index "above" the form, the making everything on the form un-clickable whilst that div is present.

this.blockingObj = document.createElement("DIV");
document.body.appendChild(this.blockingObj); = "transparent"; = - 1; // Above everything else. = document.documentElement.clientWidth + "px"; = document.documentElement.clientHeight + "px"; = "relative"; = "0px"; = "0px";

Of course you need to remove this.blockingObj when you want to re-enable the form.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900