Ok I did it.
sfValidatorBase::setRequiredMessage('This is required') has to be
placed at the begining of the configure method of the form class.

In my case, I was merging various form class before the call
sfValidatorBase::setRequiredMessage so global required message wasn't
already set for those forms.


On 9 jan, 15:19, Jérôme TEXIER <[email protected]> wrote:
> Hello,
>
> sfValidatorBase::setRequiredMessage('This is required'); seems to be
> effectless (ugly "Required." message is still displayed) when
> setInvalidMessage looks to work fine.
>
> I've also tried to override required message directly on the configure
> method of my validator class:
>
>     $messages = array
> ('required'=>'obligatoire','invalid'=>'invalide');
>     $this->setMessages($messages);
>     $this->setDefaultMessages($messages);
>
> It still works for the invalid message but not for the required one.
>
> Any idea ?
>
> Jérôme
>
> On Dec 21 2008, 2:17 pm, "Bernhard Schussek" <[email protected]>
> wrote:
>
> > On Sun, Dec 21, 2008 at 9:03 AM, Nicolas Perriault <[email protected]> 
> > wrote:
> > > As of symfony 1.2, you can do
> > > sfValidatorBase::setRequiredMessage('This is required');
>
> > > And also sfValidatorBase::setInvalidMessage('That is invalid');
>
> > That sounds great! Is it also possible to include the humanized
> > fieldname into the default message?
>
> > f.i. "Please enter the %field%"
>
> > Bernhard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to