Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ajax] onsubmit nie działa pod ie
Jim
post
Post #1





Grupa: Zarejestrowani
Postów: 111
Pomógł: 0
Dołączył: 27.07.2005

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


Witam,
mam problem z przesyłaniem formularza. Pod FF działa poprawnie, ale w IE już nie - po kliknięciu "dodaj" wyświetlana jest odpowiedź w xml'u.

w tagu <form> jest atrybut onSubmit="validate(this); return false;"
funkcja validate() sprawdza poprawnośc danych w formularzu i jeśli jest ok wywoływana jest funkcja sendform korzystająca z advAJAX'a.

oto funkcje:
  1. function sendform(form) {
  2. advAJAX.submit(form, {
  3. onSuccess : function(obj) {
  4.  
  5. var result = xml2array(obj.responseXML);
  6.  
  7. if (result["result"] == 1) {
  8. document.getElementById('addform').innerHTML = '';
  9. msg = document.getElementById("msg");
  10. msg.childNodes[0].data = "Dziękuję za zgłoszenie strony";
  11. msg.style.color = "green";
  12.  
  13. } else {
  14. msg = document.getElementById("msg");
  15. msg.childNodes[0].data = "Wystąpił błąd, spróbuj ponownie.";
  16. msg.style.color = "red";
  17. }
  18.  
  19. },
  20.  
  21. onError : function(obj) {
  22. msg = document.getElementById("msg");
  23. msg.childNodes[0].data = "Wystąpił błąd połączenia: " + obj.status;
  24. msg.style.color = "red";
  25. },
  26.  
  27. onLoading : function() {
  28. document.getElementById("submitlabel").innerHTML = '<img src="images/indicator.gif" height="16" width="16" border="0">';
  29. btn = document.getElementById("submit");
  30. btn.disabled = true; },
  31.  
  32. onFinalization : function() {
  33. document.getElementById("submitlabel").innerHTML = ''; }
  34. });
  35. }
  36.  
  37. function validate(form) {
  38. addform = document.getElementById("addform");
  39. titleLen = addform.title.value.length;
  40. descriptionLen = addform.description.value.length;
  41. urlLen = addform.url.value.length;
  42. tagsLen = addform.tags.value.length;
  43. emailLen = addform.email.value.length;
  44. email = addform.email.value;
  45.  
  46. msg = document.getElementById("msg");
  47. msg.style.color = "red";
  48.  
  49. if (titleLen <= 4) {
  50. msg.childNodes[0].data = "Za krótki tytuł strony (minimum 5 znaków).";
  51.  
  52. } else if (urlLen <= 12) {
  53. msg.childNodes[0].data = "Za krótki adres strony (pamiętaj o http://).";
  54.  
  55. } else if (descriptionLen <= 90) {
  56. msg.childNodes[0].data = "Za krótki opis strony (minimum 90 znaków).";
  57.  
  58. } else if (tagsLen <= 6) {
  59. msg.childNodes[0].data = "Za mało tagów.";
  60.  
  61. } else if (!email.match('^.+@.+..+$')) {
  62. msg.childNodes[0].data = "Niepoprwany email.";
  63.  
  64. } else {
  65. msg.childNodes[0].data = " ";
  66. sendform(form);
  67. }
  68.  
  69. }


z góry dziękuję za pomoc (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

Ten post edytował Jim 3.06.2006, 12:05:15
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: 23.08.2025 - 17:09