Zend_Validate and their returned messages

Actually I am working on several improvements to Zend_Validate.
Not only the new proposals I’ve added but also features to existing classes.
Since today one of the new features is approved and added to core.

What it is about?

When working with validators you will get messages when a validation has failed.
The content of these messages can be very large as some of them also output given values in the returned message. This can lead to a problem when the returned message has a length which you have not expected.

You will for example expect that any given failure message you want to render has a maximum length of 256 chars. So when the returned message length is 400 chars your view will look broken.

Zend_Validate allows now to limit the returned size of a message.


Now any validation message which exceeds 256 chars will be reduced to exactly 256 chars and rendered like this:

This is a long message but it is truncated here...

Of course there is also a getMessageLength() method to get the actual set size.
And as you already noted that this a static method. You can call it from your bootstrap and it will be used by all validation classes.

I hope you find this new feature usefull :-)

Thomas Weidner
I18N Team Leader, Zend Framework

Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework

Back to top