Hey Vikos,

the solution is to override the bind() (or doBind()) method and adjust
the validators based on the values passed. Then you call the parent
bind() method to trigger the actual validation.

Daniel



On Mar 21, 9:42 am, Vikos <make.webp...@gmail.com> wrote:
> Symfony version : 1.4
>
> On márc. 21, 17:40, Vikos <make.webp...@gmail.com> wrote:
>
> > Hi!
>
> > (My english is not so perfect so previously sorry for mistakes!!!)
> > I need a form witch can dynamically change the validator schema by the
> > POST's datas.
>
> > Db shcema:
> > There is the workers. They have contacts ( mail. phone, mobile...
> > homepage.. etc..).
> > A workers have many of them.
> > The worker need to distinguish the contacts that is why the contact
> > has a type.
>
> > The type has a mask ( an integer). The mask values is built in. 1:
> > free string , 2: mail, 3: phone...
>
> > worker: ID, name
>
> > contact: ID , type_id, worker_id value
>
> > contacttype: ID, mask, name.
>
> > When the I crate a new contact for a worker, i can choose the contact
> > type ( from a select ), and type the contact's value ( simple input ).
>
> > when the form income I have to validate the contact's value by the
> > type's mask. So i need to change the value validator ( "on the fly" ).
>
> > The problem is:
>
> > when I create a new ContactForm the smyfony first build up the form
> > and after it validate. But the form validators depend on the post's
> > datas witch go into the form after it is built up.
>
> > I have an answer but I think it's not elegant:
> > When I create a form object I inject the type_id via the
> > constructor.as an option.
>
> > Any one have better/more simple/more elegant idea?
>
> > Thanks!
>
> > Vikos

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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to