Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Walidacja / Porównanie Stringów
sQQuil
post
Post #1





Grupa: Zarejestrowani
Postów: 15
Pomógł: 0
Dołączył: 27.02.2011

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


Witajcie, szybka sprawa o ile można zrobiłem prosty skrypt który waliduje czy pole zostało wypełnione a jeżeli nie wywala alert.

  1. $(document).ready(function(){
  2. $("#createaccount").submit(function(){
  3. if($("#name").val() == "")
  4. {
  5. alert("Uzupełnij pole imię");
  6. return false;
  7. }
  8. else if($("#surname").val() == "")
  9. {
  10. alert("Uzupełnij pole nazwisko");
  11. return false;
  12. }
  13. else if($("#street").val() == "")
  14. {
  15. alert("Uzupełnij pole Ulica");
  16. return false;
  17. }
  18. else if($("#ndomu").val() == "")
  19. {
  20. alert("Uzupełnij pole Nr domu");
  21. return false;
  22. }
  23. else if($("#nrmieszkania").val() == "")
  24. {
  25. alert("Uzupełnij pole Nr mieszkania");
  26. return false;
  27. }
  28. else if($("#postCode").val() == "")
  29. {
  30. alert("#city");
  31. return false;
  32. }
  33. else if($("#phone").val() == "")
  34. {
  35. alert("Uzupełnij pole Telefon");
  36. return false;
  37. }
  38. else if($("#email").val() == "")
  39. {
  40. alert("Uzupełnij pole email");
  41. return false;
  42. }
  43. else if($("#verifyemail").val() == "")
  44. {
  45. alert("Powtórz adres email");
  46. return false;
  47. }
  48. else if($("#pass").val() == "")
  49. {
  50. alert("Uzupełnij pole hasło");
  51. return false;
  52. }
  53. else if($("#verifypass").val() == "")
  54. {
  55. alert("Powtórz hasło");
  56. return false;
  57. }
  58. else if($("#email") !== ($("#verifyemail")))
  59. {
  60. alert("Podane adresy email są od Siebie różne");
  61. return false;
  62. }
  63.  
  64. else if($("#email") !== ($("#verifyemail")))
  65. {
  66. alert("Podane hasła są od Siebie różne");
  67. return false;
  68. }
  69.  
  70. else
  71. {
  72. $('#createaccount').submit();
  73. }
  74.  
  75.  
  76. });
  77. });


pytanie brzmi jak teraz porównać stringi email oraz verifyemail tak żeby ocenić czy są one takie same, jeżeli tak wysłać formularz. Analogiczna sytuacja ma się do pól haseł (IMG:style_emoticons/default/smile.gif)

Jeżeli mógłby ktoś pomóc będę wdzięczny (IMG: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: 25.09.2025 - 16:52