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:
function sendform(form) {
advAJAX.submit(form, {
onSuccess : function(obj) {
var result = xml2array(obj.responseXML);
if (result["result"] == 1) {
document.getElementById('addform').innerHTML = '';
msg = document.getElementById("msg");
msg.childNodes[0].data = "Dziękuję za zgłoszenie strony";
msg.style.color = "green";
} else {
msg = document.getElementById("msg");
msg.childNodes[0].data = "Wystąpił błąd, spróbuj ponownie.";
msg.style.color = "red";
}
},
onError : function(obj) {
msg = document.getElementById("msg");
msg.childNodes[0].data = "Wystąpił błąd połączenia: " + obj.status;
msg.style.color = "red";
},
onLoading : function() {
document.getElementById("submitlabel").innerHTML = '
<img src="images/indicator.gif" height="16" width="16" border="0">';
btn = document.getElementById("submit");
btn.disabled = true; },
onFinalization : function() {
document.getElementById("submitlabel").innerHTML = ''; }
});
}
function validate(form) {
addform = document.getElementById("addform");
titleLen = addform.title.value.length;
descriptionLen = addform.description.value.length;
urlLen = addform.url.value.length;
tagsLen = addform.tags.value.length;
emailLen = addform.email.value.length;
email = addform.email.value;
msg = document.getElementById("msg");
msg.style.color = "red";
if (titleLen <= 4) {
msg.childNodes[0].data = "Za krótki tytuł strony (minimum 5 znaków).";
} else if (urlLen <= 12) {
msg.childNodes[0].data = "Za krótki adres strony (pamiętaj o http://).";
} else if (descriptionLen <= 90) {
msg.childNodes[0].data = "Za krótki opis strony (minimum 90 znaków).";
} else if (tagsLen <= 6) {
msg.childNodes[0].data = "Za mało tagów.";
} else if (!email.match('^.+@.+..+$')) {
msg.childNodes[0].data = "Niepoprwany email.";
} else {
msg.childNodes[0].data = " ";
sendform(form);
}
}
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