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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:36:55+00:00 2026-05-25T11:36:55+00:00

My form is composed of chained select. When I arrive at last, I submit

  • 0

My form is composed of chained select. When I arrive at last, I submit it, if and only if all the select are filled.

Here is my function.

$("#form_maps select").each(function(index, el){

                    var val = $(el).val();
                    if(val === null) 
                    {
                        alert('error message');
                        return false;
                    }
                    else 
                    {
                        $('#form_maps').submit();
                    }
                });

When I do my testing, an error is generated (the alert), but after a few seconds (I would say 2 or 3), the form is still submitted.

here is my html form

<form id="form_maps" method="post" style="height: 100px;">


    <select name="select_0" id="select_0">


                                    <option value="c_5" class="c_4">Excavateur</option>


                                    <option value="c_11" class="c_4">Compaction</option>

    </select>


    <select name="select_1" id="select_1">


                                    <option value="c_6" class="c_5">série 100</option>

                                    <option value="c_9" class="c_5">série 200</option>

    </select>


    <select name="select_2" id="select_2">



                                    <option value="c_7" class="c_6">above</option>

                                    <option value="c_10" class="c_6">thru</option>

    </select>


    <select name="select_3" id="select_3">


                                    <option value="c_8" class="c_7">système hydraulique</option>

                                    <option value="c_12" class="c_7">système électrique</option>

    </select>



</form>

What is my problem please? Thank you for your assistance to come.

  • 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-25T11:36:55+00:00Added an answer on May 25, 2026 at 11:36 am

    I guess your form is submitted because one of the your selects has a valid value and the return false isn’t stopping the loop. If you want to prevent to submit to form unless all selects do have a valid value, then I would suggest to use a boolean that will be set to false if one of the selects is invalid.

    Something like this:

    var canSubmit = true;
    $("#form_maps select").each(function(index, el){
        var val = $(el).val();
    
        if(val === null) 
        {
            alert('error message');
            canSubmit = false;
        }
    });
    
    if(canSubmit) {
        $('#form_maps').submit();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to add a textbox inside a form that is composed of a
Form validation for check boxes only seems to be working in IE....? Anyone have
if Form.Release is called after using the form, it will free all related memory
So, I currently have a Board class that is composed of Piece s. Each
I have a form that is composed of a couple of text fields and
I have a query of this form: SELECT e.date, SUM(e.size) as bytes FROM entries
I currently have a windows form application composed of a textbox and two buttons
I have a dataset (in the form of a file) composed of lines of
I have 4 select menus, all with the same products. (User is supposed to
Form has the DoubleBuffered property (bool, inherited from Control). If this is set to

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.