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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:33:17+00:00 2026-06-03T12:33:17+00:00

have following problem with validate checkbox array. The validation is bypassed, have taken the

  • 0

have following problem with validate checkbox array. The validation is bypassed, have taken the sample of Validation Plugin but it is not working.

// valideren formulier
$('#formulier').validate({
    onkeyup: false,
    onblur: false,
    showErrors: function(errorMap, errorList) {
        if(errorList.length > 0) {
            $("#dcMessage").dcMessage({type: "error", message: errorList[0]['message']});
        }
    },
    rules: {
        gebruikersnaam: { 
            required : true,
            minlength: 4
        },
        wachtwoord: {
            required : true,
            minlength: 8
        },
        wachtwoord2: {
            required : true,
            minlength: 8,
            equalTo: "#wachtwoord"
        },
        email: {
            email: true
        },
        opdrachtgevers: {
            required: true,
            minlength: 1
        },
        groepen: {
            required: true,
            minlength: 1
        }

    },
    messages: {
        gebruikersnaam: { 
            required : "Gebruikersnaam is verplicht.",
            minlength: jQuery.format("Gebruikersnaam moet minimaal uit {0} karakters bestaan.")

        },
        wachtwoord: {
            required : "Wachtwoord is verplicht.",
            minlength: jQuery.format("Wachtwoord moet minimaal uit {0} karakters bestaan.")
        },
        wachtwoord2: {
            required : "Herhaal wachtwoord.",
            minlength: jQuery.format("Wachtwoord moet minstens uit {0} karakters bestaan."),
            equalTo: "Wachtwoord komt niet overeen."
        },
        email: {
            email: "Geen geldig e-mailadres."
        },
        opdrachtgevers: "Selecteer minimaal één opdrachtgever.",
        groepen: "Selecteer minimaal één groep."
    },
    submitHandler: function(form) {
        // submit het formulier
        form.submit();
    }
});

and here is my form data

<div>
  <div class="groeplabel">Opdrachtgevers<em>*</em></div>
  <div class="groepinput">
    <fieldset>
    <?php
    // query; + 0 om op de juiste manier te sorteren 1,2,3,4,5,6,7,8,9,10,11 (+ 0 => converteer naar nummer)
    $sql = "SELECT opdrachtgever_id, bedrijfsnaam FROM dc_opdrachtgevers WHERE prullenbak = '0' ORDER BY bedrijfsnaam ASC";

    // uitvoeren query
    $result = mysql_query($sql) OR die ("Foutmelding: ".MySQL_errno()." ".MySQL_error());

    // opdrachtgevers aanwezig
    if(mysql_num_rows($result) > 0) {
        // doorlopen opdrachtgevers
        while($row = mysql_fetch_assoc($result)) {
              echo "<div style=\"float: left;\"><input class=\"checkbox cbgroup\" type=\"checkbox\" name=\"opdrachtgevers[]\" id=\"opdrachtgevers-" . $row["opdrachtgever_id"] . "\" value=\"" . $row["opdrachtgever_id"] . "\" /><label class=\"label\" for=\"opdrachtgevers-" . $row["opdrachtgever_id"] . "\">" . $row["bedrijfsnaam"] . "</label></div>\n";
        } 
    }
    ?>
    </fieldset>
  </div>
</div>
<div class="clearb"></div>
<div style="margin-top: 10px; padding-bottom: 10px;">
  <div class="groeplabel">Groepen<em>*</em></div>
  <div class="groepinput">
    <fieldset>
      <?php
      // query; + 0 om op de juiste manier te sorteren 1,2,3,4,5,6,7,8,9,10,11 (+ 0 => converteer naar nummer)
    $sql = "SELECT groep_id, groep_type, groep_naam FROM dc_groepen WHERE prullenbak = '0' ORDER BY groep_type + 0 ASC, groep_naam ASC";

    // uitvoeren query
    $result = mysql_query($sql) OR die ("Foutmelding: ".MySQL_errno()." ".MySQL_error());

    // groepen aanwezig
    if(mysql_num_rows($result) > 0) {
        // doorlopen groepen
        while($row = mysql_fetch_assoc($result)) {
              echo "<div style=\"float: left;\"><input class=\"checkbox cbgroup\" type=\"checkbox\" name=\"groepen[]\" id=\"groepen-" . $row["groep_id"] . "\" value=\"" . $row["groep_id"] . "\" /><label class=\"label\" for=\"rechten-" . $row["groep_id"] . "\">" . ($row["groep_type"] == "DC" ? "<font color=\"#F00\">Digicarto " . $row["groep_naam"] . "</font>": $row["groep_naam"]) . "</label></div>\n";
        } 
    }
    ?>
   </fieldset>
  </div>

Can find where it goes wrong, some can help please.

Here is my solution:

submitHandler: function(form) {
        // checkboxen niet goed
        if($(".cb_opdrachtgevers:checked").length == 0) {
            // opdrachtgevers
            $("#dcMessage").dcMessage({type: "error", message: "Selecteer minimaal één opdrachtgever."});
            return false;
        } else if($(".cb_groepen:checked").length == 0) {
            // groepen
            $("#dcMessage").dcMessage({type: "error", message: "Selecteer minimaal één groep."});
            return false;
        } else {
            // submit het formulier
            form.submit();
        }
    }
  • 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-03T12:33:20+00:00Added an answer on June 3, 2026 at 12:33 pm

    Here my solution:

    submitHandler: function(form) { 
            // checkboxen niet goed 
            if($(".cb_opdrachtgevers:checked").length == 0) { 
                // opdrachtgevers 
                $("#dcMessage").dcMessage({type: "error", message: "Selecteer minimaal één opdrachtgever."}); 
                return false; 
            } else if($(".cb_groepen:checked").length == 0) { 
                // groepen 
                $("#dcMessage").dcMessage({type: "error", message: "Selecteer minimaal één groep."}); 
                return false; 
            } else { 
                // submit het formulier 
                form.submit(); 
            } 
        } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following validation code for a text field but the 'field' below
I have a problem with Java xml validation. I have the following xsd: <?xml
I have the following code for the jQuery validation plugin.... basically on submit, I
I have the following problem: I need to validate data in a controller, which
I have following problem: I have built a tabbar application with 4 tabs. I
I have following problem, Code: String a=Yeahh, I have no a idea what's happening
I have the following problem: I have a form in site/banen (currently local running
I have the following problem. I have three classes, A, B and C. A
I have the following problem: I implemented a managed mobile application for Windows Mobile
I have the following problem that the standard library doesn't solve well, and I'm

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.