[symfony-users] Re: sfForms - group validator

2009-03-03 Thread thierrybo
On 3 oct 2008, 09:58, adrive miloslav.k...@gmail.com wrote: Hello. I am wondering, if there is any kind of group validator. I have fields which are not required unless one of them is filled. What is the best way to implement this? Can anybody give me some example of how to validate a group

[symfony-users] Re: sfForms - group validator

2008-10-21 Thread Lionel Medori
I extended the sfValidatorSchemaCompare in order to add one new operator named FORCE_TO_FILL. Then, I can do this: $this-validatorSchema-setPostValidator( new sfValidatorSchemaCompareExtension('firstname', sfValidatorSchemaCompareExtension::FORCE_TO_FILL, 'phone') ) Then, If the user

[symfony-users] Re: sfForms - group validator

2008-10-15 Thread adrive
Re patter: Thanks for the idea, but I'am trying it now in action now and it doesn't work $vs = $this-form-getValidatorSchema(); echo get_class($vs); // prints sfValidatorSchema var_dump($vs['column']);// prints NULL :( $vs['column']-setOption('required', true); // ends with Fatal error Fatal

[symfony-users] Re: sfForms - group validator

2008-10-09 Thread patter
I use a workaround for this. I know that it is not best possible solution, but it works :-) In my action: $this-form = new SomeForm(SomePeer::retriveByPK($request- getValue('id')); $validatorSchema = $this-form-getValidatorSchema(); if ($this-form-isNew())

[symfony-users] Re: sfForms - group validator

2008-10-07 Thread Kris Wallsmith
I'm not sure I understand your problem, but take a look as sfValidatorCallback. You can create a method in your form class that would of course have access to the form's validatorSchema, etc. Kris On Oct 6, 6:13 am, Thomas Rabaix [EMAIL PROTECTED] wrote: Hello, Have you try to overwrite the

[symfony-users] Re: sfForms - group validator

2008-10-06 Thread raphael Davaillaud
On 3 oct, 18:27, adrive [EMAIL PROTECTED] wrote: What is the best way to implement on two forms like this such conditional validators: If is_review in ArticleForm is set, rating from ArticleReviewForm is required. If one of opposite_ fields is set, the other ones are required. Maybe you can

[symfony-users] Re: sfForms - group validator

2008-10-06 Thread Drahpal
On 6 oct, 11:24, Miloslav Kmeť [EMAIL PROTECTED] wrote: I think, that this validators chains validators only for one field (widget). Yes, you're right! maybe the global validators are more for that (in fact validators validate only one value, global validators are more... global)?

[symfony-users] Re: sfForms - group validator

2008-10-06 Thread Miloslav Kmeť
I think, that this validators chains validators only for one field (widget). Dňa Po 6. Október 2008 09:09 raphael Davaillaud wrote: Maybe you can use the logical validator Or/And? -- Miloslav Kmeť --~--~-~--~~~---~--~~ You received this message because you

[symfony-users] Re: sfForms - group validator

2008-10-06 Thread Thomas Rabaix
Hello, Have you try to overwrite the bind method ? The idea is to remove/add validator depends on the values provided by the request. Thomas 2008/10/6 Miloslav Kmeť [EMAIL PROTECTED]: I would be glad to hear from symfony developers on this topic. I do not find any solution on this problem.

[symfony-users] Re: sfForms - group validator

2008-10-03 Thread adrive
For example I have such forms: class ArticleForm extends sfFormDoctrine { public function setUp() { $this-setWidgets(array( 'id' = new sfWidgetFormInputHidden(), 'title' = new sfWidgetFormInput(array(), array('size'=80)), 'teaser' = new