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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:27:31+00:00 2026-06-10T20:27:31+00:00

I have a search form ( you can see the form here ) that

  • 0

I have a search form (you can see the form here) that uses some javascript to check that at least one field has been completed before allowing a search to take place.

I’m not great with Javascript so please bear with me. I’ve managed to get the validation working (with the help of brilliant Stack Overflow users), and get the submit button to be re-enabled once the form has passed validation using the following code:

    $(function(){
    $('#detailed-search-form').on('submit',function(e){
        e.preventDefault();
        var oneFilled = checkFields($(this));
        if(oneFilled) {
            $(this).unbind('submit').submit()
        } else {
            overlay();
        }
    });
});

The trouble is that the first click on the submit button doesn’t actually submit the form, it simply enables the button. This the needs another click before the form is submitted.

Hopefully there’s a way I can get the form to not only re-enable the button when it’s clicked, but also submit the form without the need for a second click?

Any help will be greatly appreciated!

Thanks in advance,

Tom

  • 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-10T20:27:32+00:00Added an answer on June 10, 2026 at 8:27 pm

    The submit handler you wrote should basically say “hey, if you didn’t provide at least one field, I’ll prompt you a nice green overlay, otherwise let’s move on with the search” – no need to unbind anything.

    $(function(){
        $('#detailed-search-form').on('submit',function(e){
    
            if( !checkFields($(this)) ) {
    
                // if the form isn't valid, show overlay
                overlay();
                return false;
    
            } else {
    
               // else just continue with form action
               return true;
    
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my homepage I have a simple search form. The user can enter some
I have a search form where user can search for products within their specified
Let's say I have a form where users can search for people whose name
I have a search form on my site that submits the url in the
(Using MySQL and PHP) I have a search form that will allow my users
I have a search form tied to a backing bean that contains 4 input
I have a search program that has multiple input text boxes that correspond to
I have a search form on which I have the following INPUT field <input
I often have the need to search a javascript array that contains objects. I
I have a search form. I would like when someone type the term, first

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.