hi all..
I have to write a post validator because i want to check that values
of different embedded forms shouldn't be the same.

I don't know the best practice to do this, so I've tried doing this
way:

In my configure() function of my main form class:

// add a post validator
$this->validatorSchema->setPostValidator(
new sfValidatorCallback(array('callback' => array($this,
'checkAttitudes')))
);


and this is the post validation function (supponing to have two
embedded forms A_situazione1_0 and A_situazione1_1, and to compare the
'val' field of them):

public function checkAttitudes($validator, $values){
if($values['A_situazione1_0']['val']==$values['A_situazione1_1']
['val']){
$error = new sfValidatorError($validator, 'ahahaah');
// throw an error bound to the val field
throw new sfValidatorErrorSchema($validator, array('val' => $error));
}
return $values;
}

But of course the last is not correct because I don't want to hit a
generic 'val' field but the 'val' field of embedded form
'A_situazione1_0'

--

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.


Reply via email to