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 6742627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:51:58+00:00 2026-05-26T11:51:58+00:00

I would like to stop the submit button function, when we got any error

  • 0

I would like to stop the submit button function, when we got any error in HTML form elements (like captcha). We have several functions in our script, let me explain in details.

  1. Check the data validation only captcha security code configured with PHP (through – jquery-1.3.2.js && – validate.js)
  2. Send data through AJAX call (through – ajaxSubmit.js)

now i would like to stop the script, when any of the user filled the wrong value in Captcha text. we just simply disable the submit button and get message (“Form Not Filled Properly…”)

UPDATED VALIDATION – please check only with Captcha codes

 <script type="text/javascript">

$.validator.addMethod('myEqual', function (value, element) {
 if ($('#password-password').val() == $('#password-password-confirm').val()) {
      return true;
 }    else return false;
}, 'Your password does not match.');




  $(document).ready(function() {

 $('#password-clear').show();
$('#password-password').hide();

$('#password-clear').focus(function() {
    $('#password-clear').hide();
    $('#password-password').show();
    $('#password-password').focus();
});
$('#password-password').blur(function() {
    if($('#password-password').val() == '') {
        $('#password-clear').show();
        $('#password-password').hide();
    }
});

    $('#password-clear-confirm').show();
$('#password-password-confirm').hide();

$('#password-clear-confirm').focus(function() {
    $('#password-clear-confirm').hide();
    $('#password-password-confirm').show();
    $('#password-password-confirm').focus();
});
$('#password-password-confirm').blur(function() {
    if($('#password-password-confirm').val() == '') {
        $('#password-clear-confirm').show();
        $('#password-password-confirm').hide();
    }
});


var validator = $("#signupform").validate({

    //ignore: ".ignore",

    rules: {

        username: {
            required: true,
            minlength: 5
        },

        captcha: {
            required: true,
            remote: "includes/process.php"
        },

        password: {
            required: true,
            minlength: 5
        },
        passwordconfirm: {
            required: true,
            minlength: 5,
            myEqual: true
        },

        email: {
            required: true,
            email: true
        }
    },
    messages: {


        captcha: "Correct captcha is required. Click the captcha to generate a new one",
        username: {
            required: "Enter a username",
            minlength: jQuery.format("Enter at least {0} characters"),

        },
        password: {
            required: "Provide a password",
            rangelength: jQuery.format("Enter at least {0} characters")
        },
        passwordconfirm: {
            required: "Provide a password",
            rangelength: jQuery.format("Enter at least {0} characters")
        },
    email: {
            required: "Please enter a valid email address",
            minlength: "Please enter a valid email address"
        }


    },
    // the errorPlacement has to take the table layout into account
    errorPlacement: function(error, element) {
        if ( element.is(":radio") )
            error.appendTo( element.parent().next().next() );
        else if ( element.is(":checkbox") )
            error.appendTo ( element.next() );
        else

            error.appendTo( element.parent().next() );
    },

            submitHandler: function() {
        alert("submitted!");
    },

    // specifying a submitHandler prevents the default submit, good for the demo
    // set this class to error-labels to indicate valid fields
    success: function(label) {
        // set &nbsp; as text for IE
        label.html("").addClass("checked");
                      //  form.submit();
    }
});

 });

Please suggest me proper code for our requirement.

  • 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-26T11:51:58+00:00Added an answer on May 26, 2026 at 11:51 am

    With jQuery:

    $("#formid").submit(function (){
      if(!your condition){
        return false;
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a form, with 2 buttons <a href=index.html><button>Cancel changes</button></a> <button type=submit>Submit</button> I use
I have a search page where I would like to stop the user entering
and I would like to know if there is any way to stop a
I have several uitextfields within a view and I would like to disable the
I have a nested list of ul elements. I would like to decrease the
We would like to stop users inputing html or javascript in a text box.
I would like this ASP button control to stop calling its event handler when
I have a form on my jQuery Mobile site that I would like to
have a custom made slider which I would like to stop on hover. I've
I would like to stop images from loading, as in not even get a

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.