tag:blogger.com,1999:blog-42635487207949198.post7526298689287639847..comments2023-04-07T21:41:31.566+08:00Comments on Programmer: CodeIgniter - form_validation Errors with array Field Nameskoo pthttp://www.blogger.com/profile/00211180164799015536noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-42635487207949198.post-45116000182061201542012-09-06T05:23:00.530+08:002012-09-06T05:23:00.530+08:00Trying out your solution, but I have found that:
...Trying out your solution, but I have found that:<br /><br />$this->_field_data[$row['field']]['error'] = $message;<br /><br />Exists twice in Form_validation.php on line 528 and 676. Do we add the logic in both locations?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-42635487207949198.post-18804675287739976432011-08-03T23:23:56.400+08:002011-08-03T23:23:56.400+08:00Hi
I came to the same problem but your solution d...Hi<br /><br />I came to the same problem but your solution didn't work exactly as it should. Basically if the error is related to the N-th field it should be presented on the N-th position in your case it's coming as the first one.<br /><br />Here is my small modification:<br /><br />// Save the error message<br />if ( $row['is_array'] ){<br /> for($i=0;$i<$cycles; $i++)<br /> if(!isset($this->_field_data[$row['field']]['error'][$i]))<br /> $this->_field_data[$row['field']]['error'][$i] = '';<br /> $this->_field_data[$row['field']]['error'][$cycles] = $message;<br />}<br />else<br /> $this->_field_data[$row['field']]['error'] = $message;<br /><br />Additionally the modified _execute function could be also in MY_Form_Validation. It's better to leave original CI library files unchanged, right?Chrishttps://www.blogger.com/profile/17481679079844085168noreply@blogger.comtag:blogger.com,1999:blog-42635487207949198.post-73489345959109358482011-08-03T23:20:48.958+08:002011-08-03T23:20:48.958+08:00This comment has been removed by the author.Chrishttps://www.blogger.com/profile/17481679079844085168noreply@blogger.com