<?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>topic Re: JavaScript is not loading in my dashboard in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486710#M31898</link>
    <description>&lt;P&gt;Its called in the dashboard as below&lt;/P&gt;

&lt;P&gt;User check&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input id="user_input" type="text" token="user"&amp;gt;
  &amp;lt;label&amp;gt;Enter User ID&amp;lt;/label&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.........................&lt;BR /&gt;
.........................&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2019 08:01:33 GMT</pubDate>
    <dc:creator>GGrishma</dc:creator>
    <dc:date>2019-11-19T08:01:33Z</dc:date>
    <item>
      <title>JavaScript is not loading in my dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486709#M31897</link>
      <description>&lt;P&gt;This is the JS I'm using to check if user ID is 7 digits&lt;/P&gt;

&lt;P&gt;require([&lt;BR /&gt;
    "jquery",&lt;BR /&gt;
    "splunkjs/mvc/simplexml/ready!"&lt;BR /&gt;
], function($,TableView, mvc, DashboardController){&lt;BR /&gt;
  var checkAndSetEvents = function() {&lt;BR /&gt;
    if($("#user_input").length) {&lt;BR /&gt;
      $("#user_input").change(function(event){&lt;BR /&gt;
        if(event.target.value &amp;amp;&amp;amp; event.target.value.length &amp;gt; 7) {&lt;BR /&gt;
          $(".btn.btn-primary.submit").removeAttr("disabled");&lt;BR /&gt;
        } else {&lt;BR /&gt;
          $(".btn.btn-primary.submit").attr("disabled", "disabled");&lt;BR /&gt;
        }&lt;BR /&gt;
      });&lt;BR /&gt;
    } else {&lt;BR /&gt;
      setTimeout(checkAndSetEvents, 500);&lt;BR /&gt;
    }&lt;BR /&gt;
  }&lt;BR /&gt;
  checkAndSetEvents();&lt;/P&gt;

&lt;P&gt;});&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:00:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486709#M31897</guid>
      <dc:creator>GGrishma</dc:creator>
      <dc:date>2020-09-30T03:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript is not loading in my dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486710#M31898</link>
      <description>&lt;P&gt;Its called in the dashboard as below&lt;/P&gt;

&lt;P&gt;User check&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input id="user_input" type="text" token="user"&amp;gt;
  &amp;lt;label&amp;gt;Enter User ID&amp;lt;/label&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.........................&lt;BR /&gt;
.........................&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 08:01:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486710#M31898</guid>
      <dc:creator>GGrishma</dc:creator>
      <dc:date>2019-11-19T08:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript is not loading in my dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486711#M31899</link>
      <description>&lt;P&gt;Hi @GGrishma,&lt;/P&gt;

&lt;P&gt;Could you please share your dashboard ? &lt;/P&gt;

&lt;P&gt;Also have a look at some previous answers on how to setup JS on the XML dashboard. Could be a good idea to start with a simple alert before moving to another function : &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/586958/how-do-i-add-javascript-to-a-splunk-dashboard.html"&gt;https://answers.splunk.com/answers/586958/how-do-i-add-javascript-to-a-splunk-dashboard.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 09:57:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486711#M31899</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-11-19T09:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript is not loading in my dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486712#M31900</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
to include the script in your dashboard, please check the following:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;You have included it in your dashboard's simpleXML form tag: &lt;CODE&gt;&amp;lt;form script="myfile.js"&amp;gt; ... &amp;lt;/form&amp;gt;&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;The .js file name is relative to the &lt;CODE&gt;$SPLUNKDIR/etc/apps/&amp;lt;appname&amp;gt;/appserver/static&lt;/CODE&gt; and the file is in the right place&lt;/LI&gt;
&lt;LI&gt;The file has read permissions for the splunk process user&lt;/LI&gt;
&lt;LI&gt;You have cleared or disabled your local browser cache&lt;/LI&gt;
&lt;LI&gt;You have reloaded the server settings and cleared the caches: &lt;A href="https://yourserver:yourport/en-GB/debug/refresh"&gt;https://yourserver:yourport/en-GB/debug/refresh&lt;/A&gt; and &lt;A href="https://yourserver:yourport/en-GB/_bump"&gt;https://yourserver:yourport/en-GB/_bump&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;If it still doesn't work, maybe you could post your simpleXML and a little more details.&lt;BR /&gt;
Hope it helps&lt;BR /&gt;
Oliver&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 10:10:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486712#M31900</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2019-11-19T10:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript is not loading in my dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486713#M31901</link>
      <description>&lt;P&gt;@DavidHourani : This is my dashboard, I need to enable the submit button only when 7 digits are entered in textbox for user id.&lt;/P&gt;

&lt;P&gt;Add New User&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="user"&amp;gt;
  &amp;lt;label&amp;gt;Enter User Bank ID&amp;lt;/label&amp;gt;
&amp;lt;/input&amp;gt;
&amp;lt;input type="multiselect" token="roles" searchWhenChanged="false"&amp;gt;
  &amp;lt;label&amp;gt;Select Roles&amp;lt;/label&amp;gt;
  &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;| rest /services/authorization/roles splunk_server="local" | fields title | rename title as roles | mvexpand roles | dedup roles | sort + roles&amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;-1d@d&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldForLabel&amp;gt;roles&amp;lt;/fieldForLabel&amp;gt;
  &amp;lt;fieldForValue&amp;gt;roles&amp;lt;/fieldForValue&amp;gt;
&amp;lt;/input&amp;gt;


&amp;lt;panel&amp;gt;
    &amp;lt;search&amp;gt;
&amp;lt;query&amp;gt;|script add_user "$user$" $roles$&amp;lt;/query&amp;gt;
&amp;lt;earliest&amp;gt;-1d@d&amp;lt;/earliest&amp;gt;
&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;

&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Nov 2019 10:12:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486713#M31901</guid>
      <dc:creator>GGrishma</dc:creator>
      <dc:date>2019-11-19T10:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript is not loading in my dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486714#M31902</link>
      <description>&lt;P&gt;I have called the js in my dashboard&lt;BR /&gt;
@DavidHourani : This is my dashboard, I need to enable the submit button only when 7 digitd are entered in textbox for user id.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 10:13:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486714#M31902</guid>
      <dc:creator>GGrishma</dc:creator>
      <dc:date>2019-11-19T10:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: JavaScript is not loading in my dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486715#M31903</link>
      <description>&lt;P&gt;yes I have added my js in $SPLUNKDIR/etc/apps//appserver/static and it is readable, yet its not working.&lt;/P&gt;

&lt;P&gt;Add New User&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="user"&amp;gt;
&amp;lt;label&amp;gt;Enter User ID&amp;lt;/label&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Select Roles&lt;BR /&gt;
   All&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;query&amp;gt;| rest /services/authorization/roles splunk_server="local" | fields title | rename title as roles | mvexpand roles | dedup roles | sort + roles&amp;lt;/query&amp;gt;
 &amp;lt;earliest&amp;gt;-1d@d&amp;lt;/earliest&amp;gt;
 &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;roles&lt;BR /&gt;
   roles&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;|script add_user "$user$" $roles$&lt;BR /&gt;
 -1d@d&lt;BR /&gt;
 now&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Nov 2019 10:20:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/JavaScript-is-not-loading-in-my-dashboard/m-p/486715#M31903</guid>
      <dc:creator>GGrishma</dc:creator>
      <dc:date>2019-11-19T10:20:16Z</dc:date>
    </item>
  </channel>
</rss>

