Form_Validation prints unwanted error delimiters |
|||
|---|---|---|---|
| Date: | 08/29/2008 | Severity: | Minor |
| Status: | Resolved | Reporter: | Pascal Kriete |
| Version: | 1.7.0 SVN | ||
| Keywords: | Libraries, Validation Class | ||
| Forum Thread: | http://codeigniter.com/forums/viewthread/89251/P60/ | ||
Description
The form validation error() function (and thus, in turn the form_error() helper function) does not check for blank errors.
This results in error_delimiters being printed for fields that did not actually fail validation.
ps. The bug tracker does not list the form_validation class.
Code Sample
<?php echo form_error('password', '<span class="inline_error">', '</span>
'); ?>
Expected Result
If there are no errors, nothing should be printed.
Actual Result
When another field fails validation, all error delimiters are printed regardless of their parent field’s validation result.
Comment on Bug Report
| Posted by: beemr on 29 August 2008 3:00pm | |
|
|
This has worked for me: At line 200 replace:
if ( ! isset($this->_field_data[$field]['error']))with:
if ( ! isset($this->_field_data[$field]['error']) || $this->_field_data[$field]['error'] === '') |
| Posted by: Pascal Kriete on 2 October 2008 7:15am | |
|
|
Fixed as of Rev. 1340 |
