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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:27:37+00:00 2026-06-15T22:27:37+00:00

Watching multiple elements in a form, I would like to enable the submit button

  • 0

Watching multiple elements in a form, I would like to enable the submit button only when all elements successfully validate. Here’s what I have attempted:-

$('#beta_signup_form').validate({
    rules: {
        name: {
            required: true,
            minlength: 4
        },
        email: {
            required: true,
            email: true 
        }
    },
    focusCleanup: true,
    onkeyup: false,
    errorElement: "span",
    submitHandler: function(form) {
        if ($('#beta_signup_form').valid()) {
            console.log("now we enable the submit button!");
        }   
    }

});

UPDATES

I was expecting the submitHandler to be triggered and the if if ($('#beta_signup_form').valid()) condition to check that all our fields are valid, before we enable the submit button so that the user can click on it to make an ajax call to submit the form.

But somehow, nothing gets triggered when all fields are valid.

I figured out what I am getting wrong and that is the submitHandler attribute has nothing to do with detecting the “all fields validated” event. The submitHandler attribute only gets fired if I click on my form button, which is not what I need.

So my question is – which is the event I need to bind to? Is there an attribute that can be used for setting up a trigger when all fields in the form validate?

Here’s the form html code:-

    <form id="beta_signup_form" postUrl="{% url 'signups_beta_users' %}" method="post" csrf_token="{{ csrf_token }}">{% csrf_token %}
        <div>
            <input type="text" id="name" name="name" placeholder="Name" />
        </div>
        <div>
            <input type="email" id="email" name="email" placeholder="Email address" />
        </div>
        <button class="btn btn-success" type="submit" id="request-trial" href="#request-for-free-trial">Notify Me</button>
        <div class="loading"></div>
    </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-06-15T22:27:39+00:00Added an answer on June 15, 2026 at 10:27 pm

    My answer:

    $(document).ready(function() {
        $("#beta_signup_form").validate({
            rules: {
                name: {
                    required: true,
                    minlength: 4
                },
                email: {
                    required: true,
                    email: true
                }
            },
            submitHandler: function(form) {
                alert('submitted');
            }
        });
    });​
    

    I am posting my answer in response to the previously accepted answer to demonstrate that you do not need any special function to do what the OP is asking. The .validate() plugin already behaves like this by default.

    This is the jsFiddle from the accepted answer: http://jsfiddle.net/99mbLp1b/

    Within that answer, the only difference is this bit of conditional code used within the submitHandler.

    submitHandler: function(form) {
    
        if ($("#beta_signup_form").valid()) {
            alert('now we enable the submit button!');
        }  
    
    }
    

    As per the documentation, The submitHandler is the “Callback for handling the actual submit when the form is valid.”

    So if the submitHandler is only called when the form is valid, then this whole conditional check is completely superfluous and unnecessary…

    if ($("#beta_signup_form").valid()) { ... };
    

    It’s always going to be true, since you’d never even get into the submitHandler function if the form wasn’t already valid.

    See demo for proof: http://jsfiddle.net/uehu47w1/

    As you can see, it operates identically as the jsFiddle within the other answer.

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

Sidebar

Related Questions

I would like to have the same service on multiple servers watching a single
Say you have a JMS queue, and multiple consumers are watching the queue for
I have a function which I would like to take in an NSString and
I have a service that opens multiple watchers to watch multiple folders. After watching
I am currently watching a video from 27C3 and I would like to filter
Watching few examples that use repository pattern like StoreFront I couldn't figure out where
I'm currently watching Mule 101: Demonstrations of all things Mule tutorial because I was
I have been watching a tutorial for a game in blender, but when I
I have access to multiple network drives at my company. I'm running a test
I have some test code here <input type=radio name=group1>1 <input type=radio name=group1>2 <input type=radio

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.