Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Walidacja pól
Largo
post
Post #1





Grupa: Zarejestrowani
Postów: 203
Pomógł: 6
Dołączył: 11.09.2005

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


Witam,

Mam oto taki skrypcik:

  1. <script type='text/javascript'>
  2. function checkFields()
  3. {
  4. var requiredFields = new Array ( 'game_name', 'game_pass', 'battle_acc', 'reason', 'tid' );
  5. var errors = "";
  6.  
  7. for ( var i = 0; i < requiredFields.length; i++ )
  8. {
  9. if ( requiredFields[i] == "" )
  10. {
  11. errors += '{$this->ipsclass->lang['required_fields']}';
  12. }
  13. }
  14.  
  15. if ( errors != "" )
  16. {
  17. alert( errors );
  18. return false;
  19. }
  20. return true;
  21. }


Ma on teoretycznie bardzo proste. Ma zdefiniowane pola "name", które są wymagane. Niestety, nie działa jak powinien, nic nie robi, FF nie wyrzuca błędów, nic... Jak to poprawić?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




if ( requiredFields[i] == "" )

mala wskazowka:
przeciez pod requiredFields[i] masz tylko nazwe pola a nie pole (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
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: 4.10.2025 - 13:36