Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8404847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:42:17+00:00 2026-06-09T22:42:17+00:00

I am using the jQuery validator to handle the initial validation, and if that

  • 0

I am using the jQuery validator to handle the initial validation, and if that passes, I wish to display “Verifying…” in a div tag while the remote call is processing. Both the id and name of the div tag are “verifying”.

Where do I need to stick this code to display before launching the remote test? I want the users to understand that it may take a few seconds and that they need to wait a moment.

$(document).ready(function(){
$.validator.addMethod("noSpecialChars", function(value, element) {
    return this.optional(element) || /^[a-zA-Z0-9-_.]+$/i.test(value);
}, "Ignored");

$('[name=po_number]').focus();

jQuery.validator.messages.required = "";
$("#verifying").text("Msg #1"); // On entry
$("#form1").validate({
    invalidHandler: function(e, validator) {
        $("#verifying").text("Verifying...");
        var errors = validator.numberOfInvalids();

        if (errors) {
            var message = errors == 1
                ? 'PO must contain only letters, numbers, dashed, underscores or periods and must be between 2 and 15 characters long.'
                : 'You missed ' + errors + ' fields.  They have been highlighted below';
            $("div.productError span").html(message);
            $("div.productError").show();
        } else {
            $("div.productError").hide();
        }
    },

    onkeyup: false,
    submitHandler: function(form) {
        $("div.productError").hide();
        // start nested, remote validate
        var HTMLtable = '';
        var po_number = $('[name=po_number]').val().toUpperCase();  // Force PO to uppercase
        $('[name=po_number]').val(po_number);                               // Load upper PO back to web page

        $.ajax({ type: "GET",
            url: "remote_dup_po_check.asp?company="+company+"&customer="+customer+"&po_number="+po_number,
            async: false,
            success : function(results) {
                if (results != 0) {
                    // The remote call to Avante will generate the entire HTML
                    // table that is returned OR 0 if there are no duplicates
                    HTMLtable = results;
                }
            }
        });
        if (HTMLtable != "") {
            var msg = 'PO <b>' + po_number + '</b> has already been used by your account on the following transactiosn:<br>'
            msg = msg + HTMLtable;
            msg = msg + '<br>';
            msg = msg + 'Do you still wish to use this PO?';

            // We need to set the options to correctly drive the prompting
            var options;
            options = { };
            options['pid'] = '0';   // Needed by the returnTrue which is STORED in payment.asp but
            options['sid'] = '0';   // which is CALLED from jquery.modaldialog.js (damn confusing!)
            options['title'] = 'Duplicate PO!';
            options['width'] = '600';
            $.modaldialog.prompt(msg, options);

            // Turn off the faded background and restore to normal.
            // Appears to be needed due to the sub-level of calling?
            $('#dialog-mask').fadeOut("fast");
            verifyMsg = "Msg2";
        } else {
            alert("Unique PO\n\nSubmit disabled for debugging");
            form.submit();      // PO is unique
        }
        // end nested, remote validate
    },

    rules: {
        po_number: {
            required: true,
            noSpecialChars: true,
            rangelength:[2,15]
        }
    },

    messages: {
        po_number: {
            required: 'Please enter a PO #.',
            noSpecialChars: 'The PO must be made of letters digits, underscores, dashes and/or periods (no spaces).',
            rangelength: 'The PO must be between 2 and 15 characters.'
        }
    },
    debug:true  // this lets it hit Firebug
});

});

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:42:19+00:00Added an answer on June 9, 2026 at 10:42 pm

    If I understand your question correctly, you need to display ‘Verifying…’ when the ajax call is made. And ajax call will only be made once the local validation goes through.

    This will require you to update the div with ‘Verifying…’ text after the jquery form validation is complete. This means that instead of showing the message in invalidHandler, you might want to do that in submitHandler.

    So your submitHandler could look like:

    $("div.productError").hide();
    var po_number = $('[name=po_number]').val().toUpperCase();  // Force PO to uppercase
    $('[name=po_number]').val(po_number);
    
    $("#verifying").text("Verifying...");
    
    $.ajax({ type: "GET",
            url: "remote_dup_po_check.asp?company="+company+"&customer="+customer+"&po_number="+po_number,
            async: false,
            success : function(results) {
                if (results != 0) {
                    // The remote call to Avante will generate the entire HTML
                    // table that is returned OR 0 if there are no duplicates
                    var HTMLtable = results;
                    if (HTMLtable != "") {
                        var msg = .......
                        //Do something with result
                    }
    
                }
            }
    });
    

    Also, you might just use the asynch call instead of making it a synchronous call that might halt the rest of the script execution.

    UPDATE: display the animation for synchronous call

    If you use jQuery animate, the code is executed till the animation is completed, so here is a workaround that works for me:

    $("#verifying").text("Verifying...");
    
    $('#verifying').animate({
        opacity: 1
      }, 500, function() {
            //animation complete, call ajax here
            $.ajax({ 
                type: "GET",
                url: "remote_dup_po_check.asp?company="+company+"&customer="+customer+"&po_number="+po_number,
                async: false,
                success : function(results) {
                if (results != 0) {
                    // The remote call to Avante will generate the entire HTML
                    // table that is returned OR 0 if there are no duplicates
                    var HTMLtable = results;
                    if (HTMLtable != "") {
                        var msg = .......
                        //Do something with result
                    }
    
                    }
                }
            });
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using additional method for checking capcha validation using jquery.validate $.validator.addMethod(ajax_validation, function(value) {
I have a form that validates using the jQuery plugin: Validation, v1.9.0. The validation
I am using the JQuery Validation plugin to handle form validation. The problem I
I'm using the jQuery Validation plugin along with the qTip2 plugin to display the
I've been using the jQuery form validator, but I can't seem to figure out
Client side form validation becomes easiest by using jQuery. I tried all validators and
I'm using jQuery validation plugin. I have two images: first background of label, when
I an using jQuery validation plugin in asp.net 4.0 application. Click here to see
I am using JQuery Validation . Now I want my rules to be invoked
I am using jquery validation plugin for form validation. I have added a custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.