ESS javascript code getElementsByTagName and nodeValue

 5 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
JudeBac
Veteran Member
Posts: 129
Veteran Member

    I can't seem to make this work. I put an alert to vDmeString and tested it. It returns one row properly, however the next codes either gives me error messages methods not supported, null or not an object. Can you please help me fix the code below? The code is for ../xhrnet/personnelactions/pactions.htm. I cannot use jsreturn since it opens up a new frame list. I just need to get the code's description and put it into an input type text field.

        var vProd = authUser.prodline;
        var vDmeString = "http://lawsonprod/cgi-lawson/dme.exe?PROD=TRAINING&FILE=PCODES&INDEX=PCOSET1&KEY=";
        alert(vDmeString);
        var vDMEInfo = httpRequest(vDmeString);
        var tmpNode = vDMEInfo.getElementsByTagName('DESCRIPTION')[0];
        var uf_suppname = tmpNode.childNodes[0].firstChild.nodeValue;

    Thank you in advance.

    John Henley
    Posts: 3353
      You need to look closer at the XML that is generated from your DME...there is not a node called description.
      The node you want to search for is RECORD.
      And you want to look at the 2nd column of the first record, something like this:

      var vDMEInfo = DMEobj.document.getElementsByTagName("RECORD");
      if (vDMEInfo.length == 0)
      {
      alert("No PCODES record found.");
      return true;
      }
      else
      {
      var vCols = vDMEInfo[0].getElementsByTagName("COL");
      var uf_suppname = vCols[1].firstChild.data;
      }
      Thanks for using the LawsonGuru.com forums!
      John
      JudeBac
      Veteran Member
      Posts: 129
      Veteran Member
        as always thanks John. I am trouble shooting one line at a time, and var vDMEInfo = httpRequest(vDmeString); returns:typeof(vDMEInfo)==object and vDMEInfo.status==undefined. The string works when I paste it directly to IE but not through httpRequest. Any idea?
        John Henley
        Posts: 3353
          var vDMEInfo = top.httpRequest(vDmeString);
          var vObjDMEXML = new top.DataStorage(vDMEInfo );
          var vRecords = vObjDMEXML.document.getElementsByTagName("RECORD");
          Thanks for using the LawsonGuru.com forums!
          John
          JudeBac
          Veteran Member
          Posts: 129
          Veteran Member
            thanks, let me clean up my code. and put in a new one from your advice, appreciate it.
            JudeBac
            Veteran Member
            Posts: 129
            Veteran Member
              It works, thanks a bunch!