try putting a try/catch block around the following code, not the extra alert 
e.g.

try {
        if (xmlhttp.responseXML != null) {
            var items = xmlhttp.responseXML.getElementsByTagName("dataSet");
            var culumnname = eval("document.actionForm." + fieldname);
            for (var i = 0; i < items.length; i++) {
AppendValues(culumnname, items[i].getAttribute('dataID'), items[i].getAttribute('dataValue'));
            }
            culumnname.selectedIndex=0;
         } else {
                alert("Response XML is null");
         }
        
        
} catch ( exp ) {
        alert("Error " + e.message );
}




[EMAIL PROTECTED] wrote:
Here you go Frank:
AJAX CODE: function getNewXMLHttpRequest() {
      var _req;
      // branch for native XMLHttpRequest object (safari/mozilla)
      if (window.XMLHttpRequest) {
        _req = new XMLHttpRequest();
      }
      // branch for IE/Windows ActiveX version
      else if (window.ActiveXObject) {
        _req = new ActiveXObject("Microsoft.XMLHTTP");
      }
      return _req;
    }
    function getdataValues(fieldname){
      var state         = 
document.actionForm.state[document.actionForm.state.selectedIndex].value;
      var url = "getXMLValues.jsp?state="+state;
      var xmlhttp = getNewXMLHttpRequest();
      xmlhttp.open("GET",url,true);
      xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
          if (xmlhttp.responseXML != null) {
            var items = xmlhttp.responseXML.getElementsByTagName("dataSet");
var culumnname = eval("document.actionForm." + fieldname); for (var i = 0; i < items.length; i++) {
              AppendValues(culumnname, items[i].getAttribute('dataID'), 
items[i].getAttribute('dataValue'));
            }
            culumnname.selectedIndex=0;
          }
        }
      }
      xmlhttp.send(null);
} JSP CODE: <select name="state" onchange="getdataValues(country);">
    <option selected value="">Select a State
  </select>
  <select name="country">
    <option selected value="">Select a Country
  </select>
SERVLET CODE (modified...) ( multiple checks...)
 if (state != null && state.length() > 0)  {
   searchFor = "COUNTRY_ID, COUNTRY_NAME";
   whereIs= "STATE = '" + state + "'";
 }
sql = "SELECT " + searchFor + " FROM DATA_TABLE WHERE " + whereIs; Compile data from that query to xml and return to browser.
eg:
<?xml version="1.0" encoding="UTF-8" ?><root><dataSet dataID="USA" dataValue="United States & US Vargin Islands" 
/><dataSet dataID="AUS" dataValue="Australia" /></root>

"Frank W. Zammetti" <[EMAIL PROTECTED]> wrote:
Let me see if I'm all caught up here (I'm just back to work from vacation
today, so my brain isn't fully engaged yet)...

Everything works as expected up until the point you try to populate the
dropdown on the client, correct? The XML you get back from the servlet is
correct, so the problem lies somewhere in the code to populate the
dropdown. Sound about right?

If so, can you post said code? We might be able to spot something there. Off-hand I can't think of what the problem might be, I don't think I've
ever seen this before... I did see some issues with internationalized data
at one point, but ampersand I don't think falls in that category.


--
Gareth Evans

MSoft eSolutions Limited
Technology Centre
Inward Way
Rossmore Business Park
Ellesmere Port
Cheshire
CH65 3EN

--
Tel:    +44 (0)870 0100 704
Fax:    +44 (0)870 9010 705
E-Mail: [EMAIL PROTECTED]
Web:    www.msoft.co.uk

----------------------------------------------
Terms:
Please note that any prices quoted within this e-mail are subject to VAT.
All program details and code described in this e-mail are subject to
copyright © of MSoft eSolutions Limited and remain the intellectual
property of MSoft eSolutions Limited.
Any proposal or pricing information contained within this e-mail are
subject to MSoft eSolutions' Terms and Conditions
----------------------------------------------
Disclaimer:
This message is intended only for use of the addressee. If this message
was sent to you in error, please notify the sender and delete this
message. MSoft eSolutions Limited cannot accept responsibility for viruses,
so please scan attachments. Views expressed in this message do not
necessarily reflect those of MSoft eSolutions Limited who will not
necessarily be bound by its contents.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to