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

  • SEARCH
  • Home
  • 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 6208579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:49:58+00:00 2026-05-24T05:49:58+00:00

I am using the jQuery Plugin Validate to Validate a form I am using.

  • 0

I am using the jQuery Plugin “Validate” to Validate a form I am using. It works and just needs a touch of styling with CSS for the error messages.

However, this is the issue. I am using Ajax to submit the form so when the user submits the form the form fades out and a nice success message shows. BUT if the user missed a required field the form fades out and they see an error message. They can click a button and see the form and where the error is. Now they fix the error and then they hit submit again. They now get form submission in progress and the form will not process. They must refresh the page to get the form to submit. It is a pain and is not a good process for the user.

Here is the question: How do I validate that the user has field in all of the required fields BEFORE they hit submit and avoid the issue mentioned above?

Thanks for any advice and help.

EDIT Added Code:

AJAX and Validate Code:

<script type="text/javascript">
function jqsub() {

var $j = jQuery.noConflict();
var $jform = $j('#contactform'); // form ID
var $jmessagebox = $j('#ajaxdiv'); // message box ID
var $jsuccessmessage = "<h3>We will be in contact soon. </h3>"; // success message in HTML format
var $jerrormessage = "<h3>Error - Please Try Again</h3><p class='light_button' id='errorbutton'>Return to Form </p><p>Please Note: You may have to refresh your page before you can submit the form again. We apologize for any inconvenience. </p><p>If the error continues please contact us at <a href='mailto:support@site.com'>Support@site.com</a></p>"; //error message in HTML format

$j.ajax({
    type: 'POST',
    url: $jform.attr('action'),
    data: $jform.serialize(), 
    success: function (msg) { 
                    if (msg.FormProcessV2Response.success) {
                    $jmessagebox.append($jsuccessmessage) 
                    $jmessagebox.fadeIn();
                    }
                    else {
                    $jmessagebox.append($jerrormessage) 
                    $jmessagebox.fadeIn();  
                    }    
            },
    error: function (msg) {
                        $jmessagebox.append($jerrormessage) 
                        $jmessagebox.fadeIn();
                },
   });
$jform.fadeOut("slow", function(){ //fade out of form after success
  $jmessagebox.fadeIn("slow");
});
$j("#errorbutton").live('click',function(){ //allows form to be faded in, in the event of an error
    $jmessagebox.fadeOut("slow", function(){
        $jform.fadeIn("slow");
    });
});

}
</script>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function() {
    $j('#contactform').validate();
});
</script>

FORM CODE:

<form action="/FormProcessv2.aspx?WebFormID=45926&amp;OID={module_oid}&amp;OTYPE={module_otype}&amp;EID={module_eid}&amp;CID={module_cid}&JSON=1" enctype="multipart/form-data" onsubmit="return checkWholeForm33499(this)" method="post" name="catwebformform33499" id="contactform">
<fieldset>
<input name="FullName" type="text" class="required cat_textbox" id="FullName" value="{module_fullname}" maxlength="255" />
<label for="FullName">Full  Name<span>required</span></label>
<input name="EmailAddress" type="text" class="required email cat_textbox" id="EmailAddress" value="{module_emailaddress}" maxlength="255" /><label for="email">Email Address<span>required</span></label>
<input name="CellPhone" type="text" class="required cat_textbox" id="CellPhone" value="{module_cellphone}" maxlength="255" /><label for="cellphone">Cell Phone<span>required</span></label>
</fieldset>
<fieldset>
<textarea onkeydown="if(this.value.length&gt;=1024)this.value=this.value.substring(0,1023);" class="required cat_listbox" rows="4" cols="10" id="CAT_Custom_254790" name="CAT_Custom_254790"></textarea></td>
<label for="message">Message<span>required</span></label>
</fieldset>
<fieldset>
<label>Verification <span>required</span></label>
{module_captchav2}
</fieldset>
<div>
<input type="submit" value="Send" tabindex="5" id="submit" name="submit" class="light_button_send" />
</div>
<script type="text/javascript" src="/CatalystScripts/ValidationFunctions.js"></script>
<script type="text/javascript">
//<![CDATA[
var submitcount33499 = 0;function checkWholeForm33499(theForm){var why = "";if (theForm.CaptchaV2) why += captchaIsInvalid(theForm, "Enter Word Verification in box below", "Please enter the correct Word Verification as seen in the image"); if(why != ""){alert(why);return false;}if(submitcount33499 == 0){submitcount33499++;jqsub();return false;}else{alert("Form submission is in progress.");return false;}}
//]]>
</script>
</form>
  • 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-05-24T05:49:58+00:00Added an answer on May 24, 2026 at 5:49 am

    Why not just have your fadeIn and fadeOut calls inside your $.ajax success function?

    Something like

    $j.ajax({
        .
        .
        .
        success: function (msg) { 
                    if (msg.FormProcessV2Response.success) {
                        $jmessagebox.append($jsuccessmessage) 
                        $jmessagebox.fadeIn();
                        $jform.fadeOut("slow"
                                       , function(){ //fade out of form after success
                                           $jmessagebox.fadeIn("slow");
                        });
                    }
                    else {
                        $jmessagebox.append($jerrormessage) 
                        $jmessagebox.fadeIn();  
                    }    
            },
            .
            .
            .
    });
    

    That way, he form only fades out if there were no errors.

    As for your resubmission issue, the culprit is

    if(submitcount33499 == 0){
       submitcount33499++;
       jqsub();
       return false;
    }
    else{
       alert("Form submission is in progress.");
       return false;
    }
    

    When the form is submitted the first time, submitcount33499 gets ingremented (since it should have a value of 0 the first time around. The 2nd time around the test fails the test and goes into the else branch.

    Why are you keeping track of if submission count anyway?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jQuery.validate() plugin for a form. However the form contains a fieldset
I am using the jQuery Validate() plugin. It's been working just fine, however, I
at the moment i'm using this validation plugin: ( http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ ) but when it
I'm using the jQuery validate plugin to validate a form with a lot of
I am using jquery validate plugin to validate my form. Why I can't add
I am using jQuery validation plugin to validate my form, but it is seems
I'm trying to validate a form using jquery validate plugin and I'm having a
I'm using the jQuery.validate plugin to validate inputs for my user registration form. I've
I am using JQuery's validate plugin to validate a form. Validation occurs and the
I am using jquery and jquery.validate.cs (jQuery Validation Plugin 1.8.0) to validate a form.

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.