Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony] Nowy Validator - brak wiadomosći
Micchaleq
post
Post #1





Grupa: Zarejestrowani
Postów: 186
Pomógł: 4
Dołączył: 13.10.2009

Ostrzeżenie: (0%)
-----


Witam serdecznie,

Postanowiłem całkowicie zmienić swój post ponieważ problem w większości został roziwązany.

W większości dlatego, że teraz jak błąd wyświetla mi się jedynie wartość jaką przypiszę a nie wiadomość ktróą zdeklarowałem

  1. <?php
  2.  
  3.  
  4. class sfValidatorDefaultString extends sfValidatorString{
  5.  
  6. protected function configure($options = array(), $messages = array())
  7. {
  8. parent::configure($options, $messages);
  9.  
  10. $this->addMessage('default_string', 'Poniższe pole nie może być wysłane z domyślną wartością.');
  11.  
  12. $this->addOption('default_string');
  13. }
  14. protected function doClean($value)
  15. {
  16. $clean = parent::doClean($value);
  17.  
  18. // tutaj utknąłem
  19. if(in_array($value, $this->getOptions('default_string')))
  20. {
  21. throw new sfValidatorError($this, 'default_string', array('value' => $value['name'], 'default_string' => $this->getOption('default_string')));
  22. }
  23.  
  24. return $clean;
  25. }
  26. }
  27.  
  28. ?>


a w formie deklaruje to tak


  1. 'nazwa' => new sfValidatorDefaultString(array(), array('required' => 'Pole imie i nazwisko jest wymagane.', 'default_string' => '(imię i nazwisko)')),


Ten post edytował Micchaleq 17.04.2012, 10:35:00
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 17.09.2025 - 11:22