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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:20:16+00:00 2026-05-26T13:20:16+00:00

I know how to validate a single checkbox, but what if I have multiple

  • 0

I know how to validate a single checkbox, but what if I have multiple checkboxes and I am saving those values into an array in my database? I want the user to either select one or more check boxes, which pops an alert box.

Below is a snipet of the form and the validator I use. The rest of the form validates fine. I use asp to produce multiple check boxes, but stackoverflow isnt letting display it, so just let you know there is more than one box.

HTML:

<input type="checkbox" name="j" value="<%=getcall_1_ary(jt)%>"/>

Javascript:

 if (document.addSC.j.checked == false ) {
   alert("Select Desired Job Type")
 }
  • 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-26T13:20:17+00:00Added an answer on May 26, 2026 at 1:20 pm

    Try this code.

    <script>
        function validateCheckBoxes() 
        {
            var isValid = false;
            //alert("Check if any checkbox is not checked..."); 
            var allRows = document.getElementsByTagName("input");
            for (var i=0; i < allRows.length; i++) {
                if (allRows[i].type == 'checkbox' && allRows[i].name == '123') {
                    if (allRows[i].checked == true) {
                           return true;
                    }
                }
            }
            return isValid;
        }
    
        function submitBtn (){
            if (!validateCheckBoxes()){
                alert("no check box selected");
            }
            else 
                alert("one or more check box selected");
        }
    
    
    </script>
    

    HTML Part:

    <form  method="get">
        <input type="checkbox" name="123" />
        <input type="checkbox" name="123" />
        <input type="checkbox" name="123" />
        <input type="button" value="submit" onClick="JavaScript:submitBtn();"/>
    </form>
    

    Check it now.

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

Sidebar

Related Questions

I don't know what is going but my jquery validate plugin(1.5.5) is not working
I am developing component and I want to know how to validate email value
I'm using FluentValidation to validate input on an MVC form. I have a checkbox.
I just want to know how to validate (or clean) user input in ASP.NET
I know from here that I can pass an ignore option in the jQuery.validate
Know this might be rather basic, but I been trying to figure out how
Can you validate just a single property with the Fluent Validation Library, and if
Does anyone know how to validate the format of a url in Java using
I have a form that has many checkboxes (too many for it to make
I have a highly dynamic single page interface where various user events trigger new

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.