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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:32:09+00:00 2026-06-16T00:32:09+00:00

In my jquery validation I hve below, if multiple validation errors occur, I want

  • 0

In my jquery validation I hve below, if multiple validation errors occur, I want all validations to appear in the alert at once, rather than what it is doing at more which is displaying one validation at a time in the alert. How can I display all messages in one alert?

    function validation() {

    var alertValidation = "";
    var _qid = "";
    var _msg = "";

    $("input[data-type='qmark']").each(function(i) {
        var questions = $(this).attr("data-qnum");
        var marks = parseInt($("[class*=q" + i + "_ans_text]").text());
        var txtinput = $(this).val();
        _qid = questions;
        _msg = "You have errors on Question Number: " + _qid + "\n";


        if (txtinput == '') {
            alertValidation += "\n\u2022 You have not entered in a value in all the Indivdiaul Marks textbox\n";
        }


        if (marks < '0') {

            alertValidation += "Your Total Marks Remaining does not equal 0 \n\n\u2022 You Need To Remove " + Math.abs(marks) + " Marks";
        }

        if (marks > '0') {

            alertValidation += "Your Total Marks Remaining does not equal 0 \n\n\u2022 You Have " + marks + " Marks Remaining";
        }

        if (alertValidation != "") {
            return false; //Stop the each loop 
        }

    });


    if (alertValidation != "") {
        alert(_msg + alertValidation);
        return false;
    }

    return true;
}​
  • 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-16T00:32:10+00:00Added an answer on June 16, 2026 at 12:32 am

    Remove this Block of code

    if (alertValidation != "") {
        return false; //Stop the each loop 
    }
    

    You are already concatenating your error messages , the above line of code breaks your loop when it encounters an error. So removing this should solve your problem..

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

Sidebar

Related Questions

I am using JQuery Validation . Now I want my rules to be invoked
I am using a jquery validation plugin at: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ I want to disabled submit
I'm using the jQuery validation plugin, and I want to add a class to
I am using Jquery Validation . Currently, I have a username, what i want
When using the jQuery validation plugin (http://docs.jquery.com/Plugins/Validation/validate): I want the following behavior: Validate as
Possible Duplicate: jQuery Validation - Multiple submit buttons on one asp.net form, different validation
jQuery Validation plugin is used to validate all form data: http://docs.jquery.com/Plugins/Validation Have 3 select
How do i (using jquery validation) put all the messages in a div tag
Using this jQuery validation plugin. http://www.benjaminkeen.com/software/rsv/jquery/index.php I want to validate a checkbox group with
I'm using the jQuery validation plugin and I want make use of a custom

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.