Essentially, you have to reference the XML data in node order, if you try to
reference the first node AFTER you have referenced all the other nodes, the
first node gets returned as empty.

Take an XML data set defined as:
<data>
  <status>OK</status>
  <record>22</record>
  <userid>bart</userid>
  <date>09/01/2010</date>
  .
  .
  .
</data>

========== THIS WORKS ON THE FIRST DATA NODE ============
// Now, in the javascript on the form do this (and this works fine):
$('ajStatus').value =
transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue;

$('ajRecord').value =
transport.responseXML.getElementsByTagName('record')[0].firstChild.nodeValue;

$('ajUserid').value =
transport.responseXML.getElementsByTagName('userid')[0].firstChild.nodeValue;

$('ajDate').value =
transport.responseXML.getElementsByTagName('date')[0].firstChild.nodeValue;


========== THIS FAILS ON THE FIRST DATA NODE ============
// Turn it around and do this (and the last value will NEVER get set):
 $('ajRecord').value =
transport.responseXML.getElementsByTagName('record')[0].firstChild.nodeValue;

$('ajUserid').value =
transport.responseXML.getElementsByTagName('userid')[0].firstChild.nodeValue;

$('ajDate').value =
transport.responseXML.getElementsByTagName('date')[0].firstChild.nodeValue;

// this will fail!!!
 $('ajStatus').value =
transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue;

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to