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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:23:00+00:00 2026-05-18T10:23:00+00:00

Is there a creative and easy way to check many form fields at once.

  • 0

Is there a creative and easy way to check many form fields at once.

I have a form with generated fields on the fly, each has a unique id.

The thing is submitting all the fields are not required, but at least one field must be filled before submitting.

Is there a way to do this in Codeigniter, or how would I go about validating this effectively.

I understand that it is possible to check each field individually, but I’m seeking for a much cleaner way.

I hope it’s clear for you guys. 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-18T10:23:00+00:00Added an answer on May 18, 2026 at 10:23 am

    Right now, I have a custom function which will batch check every submission on my form to make sure it meets a set of rules. I am thinking that it may work to set up my form as an html array (data[]), retrieve it in code igniter, then use the CI callback_ validation function to make sure everything turns out okay. It seems complex, so I haven’t yet entirely wrapped my head around it, but maybe this can get your wheels turning in the right direction.

    EDIT:

    $this->load->library('form_validation');
    
    // If there is any posted data, then we should assign it to our $post_data array.
    
    $post_data = $this->input->post('project_data');
    if (empty($post_data)) {die('empty form');}
    
    // Now, we are ready to validate the incoming data.
    // We will send the data through a callback function which will check to make sure it is valid.
    // If it is not valid, the callback function will trigger a codeigniter validation error.
    
    // Let's temporarily remove any commas from the submission data to avoid delimiter confusion when sending it through the callback
    
    $post_data = str_replace(",", "DELIMITEDCOMMA", $post_data);
    
    $post_data_str = http_build_query($post_data);
    $this->form_validation->set_rules("project_data[errors]", 'Errors', "required|callback__validate_project_data[$post_data_str]");
    
    $this->form_validation->run();
    

    Then, just write your custom validation function based on what it is that you need to validate.

    function _validate_project_data($value, $request)
    {
        // A callback rule check is being attempted by the CI validator 
        // $value is the actual value of the submission, while $request is the key and value
    
        $request = explode(",", $request);
        $request = str_replace("DELIMITEDCOMMA", ",", $request);
    
        // rename the keys in the request back to the original convention
    
        parse_str($request[0], $request); 
        //var_dump($request);
    
        // perform validation here and return true or false (valid or invalid)      
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are several types of objects in a system, and each has it's own
There seem to be many ways to define singletons in Python. Is there a
There are numerous Agile software development methods. Which ones have you used in practice
There is a conversion process that is needed when migrating Visual Studio 2005 web
There are two weird operators in C#: the true operator the false operator If
There are two popular closure styles in javascript. The first I call anonymous constructor
There is previous little on the google on this subject other than people asking
There are a few ways to get class-like behavior in javascript, the most common
There is a field in my company's Contacts table. In that table, there is
There are numerous libraries providing Linq capabilities to C# code interacting with a MySql

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.