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

  • Home
  • SEARCH
  • 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 9202363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:14:22+00:00 2026-06-17T23:14:22+00:00

I have this html code that I want to validate using the Codeigniter Form_Validation

  • 0

I have this html code that I want to validate using the Codeigniter Form_Validation class :

<form id="thread" method="POST">
    <input type="checkbox" name="checkAllAuto" id="checkAll" onclick="CheckAll(this.id)" /><?php echo __t($dir_lang,'request_select_all');?> 
    <br />
    <?php foreach ($threads as $thread): ?>
    <input type="checkbox" class="threads" name="option[]" value="<?php echo $thread['th_id']; ?>" /> <?php echo $thread['th_title']; ?> <br>
    <?php endforeach; ?>
    <br />
    <input type="checkbox" name="mom" /> <?php echo __t($dir_lang,'request_send');?> 
    <br />
    <select name="cat">
        <?php foreach ($cats as $cat): ?>
        <option value="<?php echo $cat['id']; ?>"> <?php echo $cat['title']; ?> </option>
        <?php endforeach; ?>
    </select>
    <br /><input type="submit" value="<?php echo __t($dir_lang,'submit');?> " /><br>
</form>

I’m trying to validate the fist group of the check box by using Form_Validation

if ($this->input->isMethodPost())
{
    $this->tplData['showMess'] = true;
    $this->load->library('form_validation');
    $this->lang->load('form_validation', 'english');
    $this->form_validation->set_error_delimiters('<h3>', '</h3>');
    $this->form_validation->set_rules('options[]','options', 'required');
    if ($this->form_validation->run() == FALSE)
    {
        $this->tplData['showError'] = true;
        $this->tplData['mess'] = array(validation_errors());
    }else{ 
        // my work
    }
}

It gives required filed message but even if I choose one or all the checkbox it still gives the required message.

  • 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-17T23:14:23+00:00Added an answer on June 17, 2026 at 11:14 pm

    Looking at your code you set options[] as your name in set_rules:

    $this->form_validation->set_rules('options[]','options', 'required');
    

    while on your HTML your checkbox name is option[]

    <input type="checkbox" class="threads" name="option[]" value="<?php echo $thread['th_id']; ?>" />
    

    Fix this and tell me what the error is and i’ll update my answer

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

Sidebar

Related Questions

I have this html code that i want to edit with jQuery. Here is
I have a line of php code that looks like this: echo <script>$('#edit_errors').html('<h3><em>Please Correct
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
I have this html code: <div class=action> some_text <a class=delete_action name=q1>some</a> </div> <div class=action>
I want to validate email address in html form. I have very little knowledge
Possible Duplicate: Validate email address in Javascript? I have an HTML form that uses
i have this html code <table style=width: 100%;> <tr> <td> ID </td> <td> <input
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script

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.