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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:52:30+00:00 2026-05-31T00:52:30+00:00

So I have a form which needs to be validated. The rest of the

  • 0

So I have a form which needs to be validated. The rest of the form validation works but when i add the checkbox group using the php attribute [] to form the check box into an array. The checkboxes no longer work with my validation script.

$("form[name='violationsForm']").validate({
    ignore: ":hidden,[name='']", // do not validate form fields in invisible sections
    errorPlacement: function(error, element) {
         $(element).attr("class","error");
         error.insertAfter(element);
     },
    rules: {
         owner_address: { required: true, minlength: 5 }
        ,owner_county: { required: true, minlength: 1 }
        ,date1: { required: true, minlength: 2 }
        ,time1: { required: true, minlength: 2 }
        ,timeframe1: { required: true, minlength: 2 }
        ,violation[]: { required: true}
    }

});

adding ,violation[]: { required: true} Breaks the entire validation script.
Below is my form input for ref.

<li>
<label><strong>Type of Violation (required):</strong></label><br />
<label>type 1 <input type="checkbox" id="violation" name="violation[]" value="1"     
 title="Please choose at least ONE violation."/></label><br />
 <label>type 2 <input type="checkbox" id="violation" name="violation[]" value="2" />  
</label><br />
<label>type 3 <input type="checkbox" id="violation" name="violation[]" value="3" />
</label><br />
<label>type 4 <input type="checkbox" id="violation" name="violation[]" value="4" />
</label><br />
<label>type 5 <input type="checkbox" id="violation" name="violation[]" value="5" />  
</label><br />
<label>Other <input type="checkbox" id="violation_0" name="violation[]" value="other" />
</label><br />
</li>

Since I am using php I’d prefer to keep [] attached to my input “name” value. Any thoughts?

Thanks!

  • 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-31T00:52:32+00:00Added an answer on May 31, 2026 at 12:52 am

    Surround it in quotes:

    "violation[]"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which is validated through jquery, but I need the blur
I have a form which I created using PHP (something I do no understand
I have a form that needs to be validated but it does not have
I have a login form, which needs to be re-directed to the main page
I am writing an app which needs to have both the traditional form of
I need to have a checkbox which ajax-submits a form. The following code throws
I have a registration form which validates the users email with JS and PHP
I have a form in which some of the fields need to be validated
I am using jquery validation plugin for clientside validation of a form. I have
I have a form which when submitted(empty fields) displays spring validated errors in the

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.