how to validate array value in codeigniter

It doesn't let me submit the form If so, It sounds like a bug.

Temporarily, you can check whether duration[] array is empty or not:

if (! empty($_POST['duration'])) {
    $this->form_validation->set_rules('duration[]',"Duration", "trim|xss_clean|numeric");
}

I’ll update my answer if I found the main solution.


Update:
This is a bug as I expected, I opened a PR at CodeIgniter Repository, that would fix this issue.

Leave a Comment