Overwrite the constructor of the sfValidatorString class to force your own message on all sfValidatorString objects:
class mySfValidatorString extends sfValidatorString { public function _construct ($options, $messages) { $messages = array("max_length"=>"Your message here"); parent::_construct($options, $messages); } } In your own form use your new class instead of the original sfValidatorString: $validators['string_widget_name'] = new mySfValidatorString(array("max_length"=>100)); On Tue, Jan 18, 2011 at 7:47 PM, Basil Hussain < basil.huss...@experience-engine.co.uk> wrote: > I have a couple of forms with many sfValidatorString validators on > them. The default 'max_length' error message ('"%value%" is too long > (%max_length% characters max).') is really not suitable to the way my > forms are laid out in the HTML, because repeating the too-long value > within the message throws everything out of alignment. > > So, I want to set a shorter message (e.g. 'Too long, %max_length% > characters max'), but I don't want to have to add the same message > array repeatedly for every single sfValidatorString instance on these > forms - each has 20 of them! > > Is there a way to set a default 'max_length' message once for every > sfValidatorString on a form? > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc identi.ca: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en