<?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 Submit button not executing SPL search in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Javascript-Submit-button-not-executing-SPL-search/m-p/564496#M10029</link>
    <description>&lt;P&gt;I managed to solve the issue - it was actually an SPL problem as appose to JS. The Query had a mistake in it! Once I fixed this the issue disappeared. Thank you for the input &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/191127"&gt;@alucarddjin&lt;/a&gt; !&lt;/P&gt;</description>
    <pubDate>Tue, 24 Aug 2021 09:13:51 GMT</pubDate>
    <dc:creator>ChrisChalmers01</dc:creator>
    <dc:date>2021-08-24T09:13:51Z</dc:date>
    <item>
      <title>Javascript Submit button not executing SPL search</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Javascript-Submit-button-not-executing-SPL-search/m-p/563673#M10027</link>
      <description>&lt;P&gt;I am trying to create a dashboard that contains a textbox. When a ticket reference is given to the textbox and a user clicks submit, a search is run in the background that appends the ticket information to a kvstore.&lt;/P&gt;&lt;P&gt;This is my dashboard -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form script="run_action.js"&amp;gt;
  &amp;lt;label&amp;gt;QA Manual Submission&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;A dashboard that allows for the manual submission of QA Samples.&amp;lt;/description&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;&amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;input type="text" token="tokRef" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;Ticket Reference&amp;lt;/label&amp;gt;
        &amp;lt;default&amp;gt;[Letter][number]_SOC&amp;lt;/default&amp;gt;
        &amp;lt;initialValue&amp;gt;[Letter][number]_SOC&amp;lt;/initialValue&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;p&amp;gt;Click "Add to QA" to manually add the ticket number to the QA App&amp;lt;/p&amp;gt;
        &amp;lt;button class="btn btn-primary button1"&amp;gt;Add to QA&amp;lt;/button&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is javascript I am using -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;         require([
            "jquery",
            "splunkjs/mvc",
            "splunkjs/mvc/searchmanager",
            "splunkjs/mvc/tableview",
            "splunkjs/mvc/textinputview",
            "splunkjs/mvc/simplexml/ready!"
          ],function(
              mvc,
              $,
              SearchManager,
              TableView,
              TextInputView
          ) {
              
              //debug testing
              console.log("I get this far!");
              //Add after some research on Splunk Anwsers. Since removed.
              //var SearchManager = require("splunkjs/mvc");
              //var SearchManager = require("splunkjs/mvc/searchmanager");
              //var TextInputView = require("splunkjs/mvc/textinputview");
              //var TableView = require("splunkjs/mvc/tableview");
              //var $ = require("jquery");
              
              var mysearch = new SearchManager({
                  id: "mysearch",
                  autostart: "false",
                  search: mvc.tokenSafe("| jira jqlsearch \"project IN projectMatch(\\\".+_SOC.+\\\") AND assignee was in(membersOf(\"GG_JIRA_Filter\")) AND status=Closed AND created &amp;gt;= startOfMonth()\" fields \"project,summary,status,resolution,resolutiondate,updated,created,issuetype,assignee\" \r\n| table Summary, Key, \"Issue Type\", Resolution, Assignee, Resolved, Created, \"QA Commentary\", \"QA By\", \"Perceived Ticket Quality\", \"QA Pass\/Fail\"\r\n| rename Key as Ticket_Ref, \"Issue Type\" As Issue_Type\r\n| rex field=Resolved \"(?&amp;lt;date&amp;gt;\\d{4}\\-\\d{2}\\-\\d{2})T(?&amp;lt;time&amp;gt;\\d{2}:\\d{2}:\\d{2})\" \r\n| eval extracted_time=date+\" \"+time \r\n| eval Resolved=strptime(extracted_time,\"%Y-%m-%d %H:%M:%S\") \r\n| eval Resolved=round(Resolved,0) \r\n| rex field=Created \"(?&amp;lt;created_date&amp;gt;\\d{4}\\-\\d{2}\\-\\d{2})T(?&amp;lt;created_time&amp;gt;\\d{2}:\\d{2}:\\d{2})\" \r\n| eval created_extracted_time=created_date+\" \"+created_time \r\n| eval Created=strptime(created_extracted_time,\"%Y-%m-%d %H:%M:%S\") \r\n| eval Created=round(Created,0)\r\n| table Ticket_Ref, Summary, \"Issue_Type\", Resolution, Assignee, Resolved, Created, \"QA Commentary\", \"QA By\", \"Perceived Ticket Quality\", \"QA Pass\/Fail\", \"Manual QA Add\"\r\n| eval \"Manual QAA dd\"=\"True\"\r\n|  search Ticket_Ref=$tokRef$\r\n| outputlookup qa_lookup append=True")                
                });

              $(".button1").on("click", function (){
                  var ok = confirm("Are you sure?");
                  if (ok){
                      mysearch.startSearch();
                      alert('attempted restart!');
                  } //else {
                  //    alert('user did not click ok!');
                  //}
              });
            });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try to run the dashboard I get the following errors on the console -&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChrisChalmers01_0-1629212902812.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15605i31CFBB4231121EDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChrisChalmers01_0-1629212902812.png" alt="ChrisChalmers01_0-1629212902812.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Limited knowledge of JS and I've done my best to follow guidance on splunk anwsers. Would appreciate any insight.&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;Christopher&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 15:22:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Javascript-Submit-button-not-executing-SPL-search/m-p/563673#M10027</guid>
      <dc:creator>ChrisChalmers01</dc:creator>
      <dc:date>2021-08-17T15:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript Submit button not executing SPL search</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Javascript-Submit-button-not-executing-SPL-search/m-p/564082#M10028</link>
      <description>&lt;P&gt;I think the issue is with your order at the start&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        require([
            "jquery", #1st
            "splunkjs/mvc", #2nd
            "splunkjs/mvc/searchmanager", #3rd
            "splunkjs/mvc/simplexml/ready!"
          ],function(
              mvc, #1st (jquery)
              $, #2nd (mvc)
              SearchManager #3rd (searchmanager)
          &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You've got jQuery first in your requires but second in the function to mvc is mapping to the jQuery object and $ is mapping to the mvc. In your function section if you change them around so they go&amp;nbsp; &lt;STRONG&gt;$, mvc,&amp;nbsp;&lt;/STRONG&gt;it should sort out your issue.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 11:45:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Javascript-Submit-button-not-executing-SPL-search/m-p/564082#M10028</guid>
      <dc:creator>alucarddjin</dc:creator>
      <dc:date>2021-08-20T11:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript Submit button not executing SPL search</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Javascript-Submit-button-not-executing-SPL-search/m-p/564496#M10029</link>
      <description>&lt;P&gt;I managed to solve the issue - it was actually an SPL problem as appose to JS. The Query had a mistake in it! Once I fixed this the issue disappeared. Thank you for the input &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/191127"&gt;@alucarddjin&lt;/a&gt; !&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 09:13:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Javascript-Submit-button-not-executing-SPL-search/m-p/564496#M10029</guid>
      <dc:creator>ChrisChalmers01</dc:creator>
      <dc:date>2021-08-24T09:13:51Z</dc:date>
    </item>
  </channel>
</rss>

