Updated the AJAX library to remove the response DIV if it is already present (to eliminate the double message scenario).

git-svn-id: http://svn.cleancode.org/svn/pickles@40 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
Josh Sherman 2008-08-31 22:41:43 +00:00
parent 7667db3fec
commit 7c1b477731

View file

@ -81,13 +81,17 @@ function ajaxSubmit(form, customHandler, beforeOrAfter) {
}
else {
var responseMessage = document.createTextNode(responseObject.message);
responseElement.className = responseObject.type;
responseElement.appendChild(responseMessage);
}
if (document.getElementById('ajaxResponse') != null) {
form.removeChild(document.getElementById('ajaxResponse'));
}
responseElement.id = 'ajaxResponse';
form.insertBefore(responseElement, (beforeOrAfter == 'before') ? form.firstChild : form.lastChild);
}
}