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
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
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
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())
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
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
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)?
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
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.
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
10 matches
Mail list logo