[pLog-svn] r6545 - plog/branches/lifetype-1.2/js/ui

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat Jun 14 15:21:21 EDT 2008


Author: jondaley
Date: 2008-06-14 15:21:21 -0400 (Sat, 14 Jun 2008)
New Revision: 6545

Modified:
   plog/branches/lifetype-1.2/js/ui/plogui.js
Log:
fix javascript die on xml return if the id isn't set

Modified: plog/branches/lifetype-1.2/js/ui/plogui.js
===================================================================
--- plog/branches/lifetype-1.2/js/ui/plogui.js	2008-06-14 17:53:40 UTC (rev 6544)
+++ plog/branches/lifetype-1.2/js/ui/plogui.js	2008-06-14 19:21:21 UTC (rev 6545)
@@ -53,9 +53,11 @@
 {
 	//put returned XML in the textarea
 	var xmldoc = originalRequest.responseXML;
-	var id = xmldoc.getElementsByTagName('id')[0].firstChild.nodeValue;
+	var id_elem = xmldoc.getElementsByTagName('id');
+    if(id_elem[0]){
+        $( 'postId' ).value = id_elem[0].firstChild.nodeValue;
+    }
 	var message = xmldoc.getElementsByTagName('message')[0].firstChild.nodeValue;
-	$( 'postId' ).value = id;
 	window.alert(message);
 }
 
@@ -225,4 +227,4 @@
    button.style.display = "none";     
    bar = document.getElementById("status_bar");
    bar.style.display = "block";
-}
\ No newline at end of file
+}



More information about the pLog-svn mailing list