You need to exchange the validator schema of the form with your own
validator schema class, and overwrite the preClean() method there.

This is the only way to ensure that your form behaves the same whether
it is used standalone or embedded elsewhere.

Johannes

On 21 Mai, 15:04, kadia <kadial...@gmail.com> wrote:
> I want to set a validor for a field on configure (), but the field can
> be required or not, it depends on the value of another field. Now I
> need set the condition following the value of that filed but I can
> find the good function, for having that value.
>
> I have to use it one configure() function.
>
> class FormuleForm extends BaseFormuleForm
> {
>
>   public function configure()
>   {
>
> ///  I have tried this, but it's not ok
>
>   if ($this->getValue('idsitecompactage')==2)
>           {$this->validatorSchema['commentaire']=new
> sfValidatorString(array('required' => true));
>           }
> *******
>
> }
> }
>
> --
> 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 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
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

Reply via email to