Hi,
I am adding custom error messages to elements, but I am only able to add message as a string, while validators seem to add it as an array with the error code as the key. This way I end up with different error format depending on where the error came from.
When I need to return the errors in xml to external applications this is a big problem for me. Any idea how to do this correctly?
Thanks for the help.
SWK
Here is what I mean:
Code:
When I do: $element->addError ( $message );
$form->getMessages() returns:
array(1) {
["some_field"] => array(1) {
[0] => string(16) "custom_message"
}
}
When a validator fails on the element
$form->getMessages() returns:
array(1) {
["some_field"] => array(1) {
["some_errorcode"] => string(16) "custom message"
}
}