<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Getting Error as &amp;quot;[object HTMLDivElement]&amp;quot; in alert. in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/getting-error-as-quot-object-htmldivelement-quot-in-alert/m-p/548027#M119806</link>
    <description>&lt;P&gt;while I am trying the below Script , I am getting a Output as below&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;[object HTMLDivElement].&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;function onSubmit() {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; //Type appropriate comment here, and begin script below&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var oci_nt_val;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var answer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var acct_name = g_form.getValue('accountName');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var a = new GlideAjax('cidr_POST');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; a.addParam('sysparm_acct_name', acct_name);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; a.getXML(getResponse);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; function getResponse(response) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; answer = response.responseXML.documentElement.getAttribute("answer");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert('Network Value : ' + answer.substring(answer.indexOf('-') + 1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; oci_nt_val = answer.substring(0, answer.indexOf('-'));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setValue('httpstatus_value', oci_nt_val);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;&amp;nbsp;alert("HttpStatus : " + httpstatus_value);&amp;nbsp; // Here getting alert as &lt;SPAN style="color: #e03e2d;"&gt;Http Status : [object HTMLDivElement]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please suggest me the code&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2022 11:33:47 GMT</pubDate>
    <dc:creator>Anusha Savanth</dc:creator>
    <dc:date>2022-08-10T11:33:47Z</dc:date>
    <item>
      <title>Getting Error as "[object HTMLDivElement]" in alert.</title>
      <link>https://www.servicenow.com/community/itsm-forum/getting-error-as-quot-object-htmldivelement-quot-in-alert/m-p/548027#M119806</link>
      <description>&lt;P&gt;while I am trying the below Script , I am getting a Output as below&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;[object HTMLDivElement].&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;function onSubmit() {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; //Type appropriate comment here, and begin script below&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var oci_nt_val;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var answer;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var acct_name = g_form.getValue('accountName');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var a = new GlideAjax('cidr_POST');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; a.addParam('sysparm_acct_name', acct_name);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; a.getXML(getResponse);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; function getResponse(response) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; answer = response.responseXML.documentElement.getAttribute("answer");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert('Network Value : ' + answer.substring(answer.indexOf('-') + 1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; oci_nt_val = answer.substring(0, answer.indexOf('-'));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setValue('httpstatus_value', oci_nt_val);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;&amp;nbsp;alert("HttpStatus : " + httpstatus_value);&amp;nbsp; // Here getting alert as &lt;SPAN style="color: #e03e2d;"&gt;Http Status : [object HTMLDivElement]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please suggest me the code&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 11:33:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/getting-error-as-quot-object-htmldivelement-quot-in-alert/m-p/548027#M119806</guid>
      <dc:creator>Anusha Savanth</dc:creator>
      <dc:date>2022-08-10T11:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error as "[object HTMLDivElement]" in alert.</title>
      <link>https://www.servicenow.com/community/itsm-forum/getting-error-as-quot-object-htmldivelement-quot-in-alert/m-p/548028#M119807</link>
      <description>&lt;P&gt;In your script you do not define httpstatus_value as a javascript variable, but in your alert you are calling it has such. Are you trying to display the value of the field you just set? You would need to call a method, not the field name.&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;alert("HttpStatus : " + g_form.getValue("httpstatus_value"));  // Here getting alert as Http Status : [object HTMLDivElement]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope this helps!&lt;/P&gt;
&lt;P&gt;If this was helpful, or correct, please be kind and mark the answer appropriately.&lt;/P&gt;
&lt;P&gt;Michael Jones - Proud member of the GlideFast Consulting Team!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 11:56:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/getting-error-as-quot-object-htmldivelement-quot-in-alert/m-p/548028#M119807</guid>
      <dc:creator>Michael Jones -</dc:creator>
      <dc:date>2022-08-10T11:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Error as "[object HTMLDivElement]" in alert.</title>
      <link>https://www.servicenow.com/community/itsm-forum/getting-error-as-quot-object-htmldivelement-quot-in-alert/m-p/548029#M119808</link>
      <description>&lt;P&gt;It is working. Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have added like this,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;alert("HttpStatus : " + g_form.getValue('httpstatus_value') + " " + typeof(httpstatus_value));&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;and It is giving output as &lt;STRONG&gt;Object type&lt;/STRONG&gt;. How to convert it to String and add to variable.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;output&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;HttpStatus : 200 object&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 14:02:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/getting-error-as-quot-object-htmldivelement-quot-in-alert/m-p/548029#M119808</guid>
      <dc:creator>Anusha Savanth</dc:creator>
      <dc:date>2022-08-10T14:02:15Z</dc:date>
    </item>
  </channel>
</rss>

