0
にsfValidatorOrのエラーを追加私が持っている:はsymfonyの
$this->validatorSchema->setPostValidator(new sfValidatorOr(
array(
new sfValidatorSchemaCompare('email', '!=', ''),
new sfValidatorSchemaCompare('phone', '!=', ''),
),
array(),
array('invalid' => 'Campo obligatorio')
));
エラー)(ます$ form-> getGlobalErrorsです。
$this->validatorSchema->setPostValidator(
new sfValidatorOr(
array(
new sfValidatorAnd(
array(
new sfValidatorSchemaCompare('date_from', sfValidatorSchemaCompare::EQUAL, 'date_to',
array('throw_global_error' => true),
array('invalid' => 'The start date ("%left_field%") must be equal the end date ("%right_field%")')),
new sfValidatorSchemaCompare('time_from', sfValidatorSchemaCompare::LESS_THAN, 'time_to',
array('throw_global_error' => true),
array('invalid' => 'The start time ("%left_field%") must be before the end time ("%right_field%")')),
)),
new sfValidatorSchemaCompare('date_from', sfValidatorSchemaCompare::LESS_THAN, 'date_to',
array('throw_global_error' => true),
array('invalid' => 'The start date ("%left_field%") must be before the end date ("%right_field%")')),
)
));
:どのように私は
配列( 'throw_global_error' =>真)、
ここと同じように追加することができますか?
私はこのレンダリングされます。)
<?php $form['email']->renderLabel() ?>
**<?php echo $form['email']->getError() ?>**
をしかしsfValidatorOrでは、これはあなたがsfValidatorSchemaCompare(上で直接throw_global_errorオプションを置くことができます