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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:10:54+00:00 2026-06-11T19:10:54+00:00

I took the edit from this SF link: StackOverflow link , where user Blazemonger

  • 0

I took the edit from this SF link: StackOverflow link, where user Blazemonger showed a demo in, JFiddle Demo

From the above:
1) How do I show all the error(s), not just one at a time, in a DIV statement below the submit button instead of the alert box?
2) How do i change the bg color back to white once the error is correct and the submit button is pressed again?

I edited the fiddle like this for Question 2, which is not working:

$("form").submit(function() {
    var submitme = true;
    $(':radio').each(function() {
        nam = $(this).attr('name');
        if (submitme && !$(':radio[name="'+nam+'"]:checked').length) {
            alert(nam+' group not checked');
            $(':radio[name="'+nam+'"]+label').addClass('error');
            submitme = false;
        }
        if (submitme && $(':radio[name="'+nam+'"]:checked').length <> 0) {
                $(':radio[name="'+nam+'"]+label').addClass('noerror');
        }
    });
    return submitme;
});

CSS:

.error {
    background-color: red;
}
.noerror {
    background-color: white;
}
  • 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-11T19:10:56+00:00Added an answer on June 11, 2026 at 7:10 pm

    On the click of the button you can check if one value in each group is selected and if not display a div ..

    Check this UPDATED FIDDLE

    $("form").submit(function() {
        var html = '';
        var submitme = true;
        $(':radio').each(function() {
            nam = $(this).attr('name');
            if (!$(':radio[name="'+nam+'"]:checked').length) {
                $(':radio[name="'+nam+'"]+label').addClass('error');
                if(html.indexOf(nam) < 0){
                    html += nam +' group not checked' + '</br>';
                }
                submitme = false;
            }
        });
        if(submitme == false){
           $('.errorDiv').empty().append(html).show().addClass('error');
        }
        else{
          $('.errorDiv').hide();
        }
    
        return submitme;
    });
    ​
            ​
            .error {
                background-color: red;
                display:none;
            }
    

    ​

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

Sidebar

Related Questions

I took this script from here : import csv from itertools import izip f
EDIT I'm understand the table is a mess. I took over this project and
I'm facing a problem with IE6. I took the toggle function from this website
EDIT -- took the code from below and made it so it can handle
Been trying to do this for quite a while and took advice from every
I took the rendered page from the SWT Browser and exported it to an
I took the example code from the Kendo UI demos at http://demos.kendoui.com/web/grid/remote-data.html , binding
I took over an old HTML based site with all hard coded links, no
I took a look at this answer and it goes in part to solving
I took some code here: Check if role consists of particular user in DB?

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.