Naprawdę denerwujące jest tworzenie dla każdego obiektu INPUT (który ma być walidowany) tablicy z opisami błędów jakie ewentualnie
wystąpiły podczas walidacji.
Przykładowy plik który otwieram metodą $post->errors('plik'):
plik.php
( 'alpha' => 'Only alphabetic characters are allowed.', 'length' => 'The name must be between three and twenty letters.', 'required' => 'The number cannot be blank.', 'numeric' => 'Only numbers are allowed.', 'default' => 'Invalid Input.', 'email'=>' Email is wrong', ), 'alpha' => 'Only alphabetic characters are allowed.', 'length' => 'The name must be between three and twenty letters.', 'required' => 'The number cannot be blank.', 'default' => 'Invalid Input.', ), 'alpha' => 'Only alphabetic characters are allowed.', 'length' => 'The name must be between three and twenty letters.', 'required' => 'The number cannot be blank.', 'default' => 'Invalid Input.', ) ); ?>
Dla mnie to jest totalna porażka takie rozwiązanie a raczej powtarzanie siebie. Jest to metoda zalecana w oficjalnej dokumentacji Kohana.
Kiedyś we wcześniejszych wersjach fw, można było używać pliku validation.php i wszystko było ok. Na forum kohana nic nie znalazłem co
by mi pomogło.
Może ktoś z Was ma jakieś swoje rozwiązanie ?