Witajcie pisze formularz do rejestracji chce porównać pola z hasłami czy są takie same. Czy mógł by mi ktoś wytłumaczyć jak to ustalić w walidatorze? piszę w symfony 1.4 Kod:
<?php
class RejestracjaForm extends BaseForm
{
public function configure()
{
'login' => new sfWidgetFormInputText
(array('label' => 'Login')), 'email' => new sfWidgetFormInputText
(array('label' => 'Email')), 'haslo' => new sfWidgetFormInputPassword
(array('label' => 'Hasło')), 'haslo2' => new sfWidgetFormInputPassword
(array('label' => 'Powtórz hasło')), ));
$this->widgetSchema->setNameFormat('rejestracja[%s]');
$this->mergePostValidator(new sfValidatorSchemaCompare
('haslo', sfValidatorSchemaCompare
::EQUAL, 'haslo2', array(), array('invalid' => 'Oba hasła muszą być takie same.'))); $this->setValidators(array( 'login' => new sfValidatorString
(array('required' => true), array('required' => 'Pole jest wymagane')), 'email' => new sfValidatorEmail
(array(), array('invalid' => 'Wpisz prawidłowy adres','required' => 'Pole jest wymagane')), 'haslo' => new sfValidatorString
(array('required' => true), array('required' => 'Pole jest wymagane')), 'haslo2' => new sfValidatorString
(array('required' => true), array('required' => 'Pole jest wymagane')), ));
}
}