Welcome Guest, Not a member yet? Register   Sign In
Array of Validation Errors -- With Field Names!
#1

[eluser]CodeIgniterNewbie[/eluser]
Is there a way to get an array of validation errors in $key => $value format, where $key is the name of the field and $value is the actual validation error.

I could explode validation_errors() using "\n" as the delimiter, but that only gives me the error messages. I need this information paired with its associated field. I want to be able to do this without have explicit knowledge of the form that is being validated.

By the way, this produces an extra element at the end. It contains an empty string. Does anyone know why?

Code:
var_dump(explode("\n", validation_errors()));


Messages In This Thread
Array of Validation Errors -- With Field Names! - by El Forum - 02-11-2010, 08:25 AM
Array of Validation Errors -- With Field Names! - by El Forum - 02-13-2010, 05:13 AM
Array of Validation Errors -- With Field Names! - by El Forum - 02-13-2010, 12:30 PM
Array of Validation Errors -- With Field Names! - by El Forum - 02-13-2010, 02:03 PM
Array of Validation Errors -- With Field Names! - by El Forum - 02-13-2010, 02:08 PM
Array of Validation Errors -- With Field Names! - by El Forum - 02-13-2010, 02:43 PM
Array of Validation Errors -- With Field Names! - by El Forum - 02-13-2010, 02:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB