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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:20:44+00:00 2026-06-09T02:20:44+00:00

I need to validate to see if at least one checkbox is checked before

  • 0

I need to validate to see if at least one checkbox is checked before sending the data to the form sending script.
this is what i have so far (to validate all fields the checkbox one is at the bottom)

$('form#ajax_form .submit').click(function () {
    $('#ajax_form .error').hide(); //if error visibile, hide on new click
    var name = $('input#name').val();
    if (name == "" || name == " " || name == "Name") {
        $('input#name').focus().before('<div class="error">Hey, what´s your name...?</div>');
        return false;
    }
    var email_test = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
    var email = $('input#email').val();
    if (email == "" || email == " ") {
        $('input#email').focus().before('<div class="error">Psssst. You missed one...</div>');
        return false;
    } else if (!email_test.test(email)) {
        $('input#email').select().before('<div class="error">Please recheck your email</div>');
        return false;
    }
    var message = $('#message').val();
    if (message == "" || message == " " || message == "Message") {
        $('#message').focus().fadeIn('slow').before('<div class="error">Remember your message!</div>');
        return false;
    }
    if ($("[name=Field]:checked").length > 0) {
        $('#services1').focus().after('<div class="error">Choose at least one please.</div>');
        return false;
    }
    var company = $('input#company').val();
    $.post(rootUrl + '/wp-admin/admin-ajax.php', {
        action: "two2_send_contact_form",
        email: email,
        name: name,
        message: message,
        company: company
    }, function (data) {
        $('form#ajax_form').slideUp('fast').before('<div id="success"></div>');
        $('#success').html(data).slideDown(9000);
    });

and the checkboxes.

 <div style="display:inline;">
    <span>
      <label class="choice" for="Field1" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field1" name="Field[]" type="checkbox" class="field checkbox" value="Web Design" style="width:0px;">Web Design    
 </label>
    </span>
    <span>
      <label class="choice" for="Field2" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field2" name="Field[]" type="checkbox" class="field checkbox" value="Graphic Design" style="width:0px;">Graphic Design
</label>
    </span>
    <span>
      <label class="choice" for="Field3" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field3" name="Field[]" class="field checkbox" type="checkbox" value="Illustration" style="width:0px;">Illustration
 </label>
    </span>
    <span>
      <label class="choice" for="Field4" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field4" name="Field[]" type="checkbox" class="field checkbox" value="Identity Dev/Branding" style="width:0px;">Identity Dev/Branding
</label>
    </span>
    <br>
    <span>
      <label class="choice" for="Field1_3" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field5" name="Field[]" class="field checkbox" type="checkbox" value="Identity Dev/Branding" style="width:0px;">Web App Development
</label>
    </span>
    <span>
      <label class="choice" for="Field1_4" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field6" name="Field[]" class="field checkbox" type="checkbox" value="CGI" style="width:0px;">CGI
</label>
    </span>
    <span>
      <label class="choice" for="Field1_5" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field7" name="Field[]" class="field checkbox" type="checkbox" value="VFX" style="width:0px;">VFX
</label>
    </span>
    <span>
      <label class="choice" for="Field1_6" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field8" name="Field[]" class="field checkbox" type="checkbox" value="Video Production" style="width:0px;">Video Production 
 </label>
    </span>
    <span>
      <label class="choice" for="Field1_7" style="display:inline;margin-left:0px;margin-right:5px;">
        <input id="Field9" name="Field[]" class="field checkbox" type="checkbox" value="Motion Project" style="width:0px;">Motion Project
</label>
    </span>
  </div>
  • 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-09T02:20:47+00:00Added an answer on June 9, 2026 at 2:20 am
    $('input[type="checkbox"]:is("checked")').length > 0 
    

    at least one checkbox is check

    With jquery > 1.7 you can call

    $('input:checked').length
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to validate submitted form data: To check whether fields are empty. Proceed
I have some form numbers I need to validate. I've tried multiple attempts but
I need to validate a form with a bunch of inputs in it. And,
I'm coding this plugin that validates if a series of checkbox groups have at
I need help remembering what book I read this from, It might have been
I want to validate my registration form but i have default values for every
We have one of those weird cryptic data corruption bugs that pops up every
I need to validate an object to see whether it is null, a value
I've created a custom validation script for my website because people need to validate
I currently have a requirement where I need to validate that all the files

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.