Re: [symfony-users] Setting default error messages for forms (1.4.1)

2009-12-18 Thread YTH
Dear Campezzia,

I am using Symfony 1.2.9, but the following codes may also work in 1.4.1.

class frontendConfiguration extends sfApplicationConfiguration
{
  public function configure()
  {
   sfValidatorBase::setRequiredMessage("This field is required.");
   sfValidatorBase::setInvalidMessage("This field is Invalid.");
  }
}


- Original Message - 
From: "Campezzi" 
To: "symfony users" 
Sent: Thursday, December 17, 2009 9:39 PM
Subject: [symfony-users] Setting default error messages for forms (1.4.1)


> Hello folks,
>
> I've been trying to set default error messages on my forms so that I
> don't have to "repeat myself" setting them field by field - for
> example, setting global "required" and "invalid" messages. Looking at
> the API, this seems simple enough by calling the setMessages() method
> on my form's validatorSchema, so I've tried this inside my form's
> configure() method:
>
>
>$this->validatorSchema->setMessages(array(
>  'required' => 'This field is required.',
>  'invalid' => 'The information you entered is invalid.'
>));
>
> However, to my surprise, it does nothing! No errors/warnings/
> exceptions, yet nothing actually happens and the same old "Required."
> and "Invalid." messages pop up on my form.
>
> Is there something incredibly dumb I'm missing here or is this just a
> bug in sf 1.4?
>
> Thanks for your time!
>
> Best Regards,
>
> Thiago Campezzi
> campe...@gmail.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-us...@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.
>
>
>
> __ NOD32 4694 (20091216) Information __
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.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-us...@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.




[symfony-users] Setting default error messages for forms (1.4.1)

2009-12-17 Thread Campezzi
Hello folks,

I've been trying to set default error messages on my forms so that I
don't have to "repeat myself" setting them field by field - for
example, setting global "required" and "invalid" messages. Looking at
the API, this seems simple enough by calling the setMessages() method
on my form's validatorSchema, so I've tried this inside my form's
configure() method:


$this->validatorSchema->setMessages(array(
  'required' => 'This field is required.',
  'invalid' => 'The information you entered is invalid.'
));

However, to my surprise, it does nothing! No errors/warnings/
exceptions, yet nothing actually happens and the same old "Required."
and "Invalid." messages pop up on my form.

Is there something incredibly dumb I'm missing here or is this just a
bug in sf 1.4?

Thanks for your time!

Best Regards,

Thiago Campezzi
campe...@gmail.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-us...@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.