<?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: How to adjust the click width of a JS button? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392171#M25705</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;One way you can solve this issue by having the onclick method like below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'jquery',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function($, mvc){
    $("#submit_button button").click(function(){
         alert("test");
     });

});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 Jul 2019 04:25:14 GMT</pubDate>
    <dc:creator>vnravikumar</dc:creator>
    <dc:date>2019-07-19T04:25:14Z</dc:date>
    <item>
      <title>How to adjust the click width of a JS button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392169#M25703</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I have implemented a JS button per&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/758599/is-it-possible-to-add-a-button-in-line-with-inputs.html"&gt;https://answers.splunk.com/answers/758599/is-it-possible-to-add-a-button-in-line-with-inputs.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;However, I am only able to adjust the visual width, not the click width. That is, after the visual width is adjusted and made smaller, you can click on the gray space to the right of the button and it will still submit. How do I fix this?&lt;/P&gt;

&lt;P&gt;If there is no direct fix here - and hopefully there is - I am open to other JS button choices besides link only if they are also an    &lt;CODE&gt;&amp;lt;input&amp;gt;&lt;/CODE&gt; (I need the button to be in line with other inputs per 758599).&lt;/P&gt;

&lt;P&gt;Button:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;input type="link" id="submit_button"&amp;gt;
    &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
    &amp;lt;choice value="submit"&amp;gt;Submit&amp;lt;/choice&amp;gt;
  &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Style:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;style&amp;gt;
    #submit_button div[data-component="splunk-core:/splunkjs/mvc/components/LinkList"]
    {
      width:35% !important;
    }
    #submit_button  button  {
      padding: 6px 15px !important;
      border-radius: 3px !important;
      font-weight: 500 !important;
      background-color: #5cc05c !important;
      border: transparent !important;
      color: #fff !important;
    }
    #submit_button  button:hover{
      background-color: #40a540 !important;
      border-color: transparent !important;
    }
    &amp;lt;/style&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Jul 2019 17:32:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392169#M25703</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2019-07-18T17:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust the click width of a JS button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392170#M25704</link>
      <description>&lt;P&gt;@nick405060 how about the following approach with a separate panel next to Splunk Input and with a html button? &lt;BR /&gt;
You would need to code html button using Simple XML JS extension.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7341i9DBEA6FAD2C39267/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
Following is the Simple XML code example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;HTML Button on right aligned with Splunk inputs on left&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
   &amp;lt;panel id="panelInputs"&amp;gt;
     &amp;lt;input type="text" token="networkIdOnChange" searchWhenChanged="false"&amp;gt;
       &amp;lt;label&amp;gt;NetworkID:&amp;lt;/label&amp;gt;
       &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
     &amp;lt;/input&amp;gt;
     &amp;lt;input type="text" token="networkid" depends="$justHideMe$" searchWhenChanged="false"&amp;gt;
       &amp;lt;default&amp;gt;$networkIdOnChange$&amp;lt;/default&amp;gt;
     &amp;lt;/input&amp;gt;
   &amp;lt;/panel&amp;gt;
   &amp;lt;panel id="panelSubmit"&amp;gt;
     &amp;lt;html&amp;gt;
       &amp;lt;style&amp;gt;
         #panelInputs .dashboard-panel{
            margin-right: 0px !important;
         }
         #htmlSubmitButton{
            padding:6px 15px;
            margin-right: 20px;
            border-radius:3px;
            font-weight: 500;
            background-color: #5cc05c;
            border: transparent;
            color: #fff;
            float:right;
         }
         #htmlSubmitButton:hover{
           background-color: #40a540 !important;
           border-color: transparent !important;
         }
       &amp;lt;/style&amp;gt;
      &amp;lt;div style="padding-top: 20px;"&amp;gt;
        &amp;lt;input id="htmlSubmitButton" type="submit" name="Submit"&amp;gt;&amp;lt;/input&amp;gt;
      &amp;lt;/div&amp;gt;
     &amp;lt;/html&amp;gt;
   &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Jul 2019 02:27:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392170#M25704</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-07-19T02:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust the click width of a JS button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392171#M25705</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;One way you can solve this issue by having the onclick method like below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'jquery',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function($, mvc){
    $("#submit_button button").click(function(){
         alert("test");
     });

});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Jul 2019 04:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392171#M25705</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-07-19T04:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust the click width of a JS button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392172#M25706</link>
      <description>&lt;P&gt;I tried this, but it doesn't fix the issue. You can still click to the right of the button and have it submit, and if you place another input next to the button it is offset by a fair amount. The visual width is being adjusted but not the width behind the scenes&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 16:46:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392172#M25706</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2019-07-19T16:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust the click width of a JS button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392173#M25707</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="test.js"&amp;gt;
  &amp;lt;label&amp;gt;button&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false" autoRun="false"&amp;gt;&amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html depends="$hide$"&amp;gt;
       &amp;lt;style&amp;gt;

        #submit_button{
          width:80px !important;
         }

         #submit_button div[data-component="splunk-core:/splunkjs/mvc/components/LinkList"]{
          width:80px !important;
          }

        #submit_button  button{
          padding: 6px 15px !important;
          border-radius: 3px !important;
          font-weight: 500 !important;
          background-color: #5cc05c !important;
          border: transparent !important;
          color: #fff !important;
        }

        #submit_button  button:hover{
          background-color: #40a540 !important;
          border-color: transparent !important;
        }
        &amp;lt;/style&amp;gt;
    &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;input type="text" token="networkIdOnChange" searchWhenChanged="false"&amp;gt;
        &amp;lt;label&amp;gt;NetworkID:&amp;lt;/label&amp;gt;
        &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="text" token="networkid" depends="$justHideMe$" searchWhenChanged="false"&amp;gt;
        &amp;lt;default&amp;gt;$networkIdOnChange$&amp;lt;/default&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="link" id="submit_button"&amp;gt;
        &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;choice value="submit"&amp;gt;Submit&amp;lt;/choice&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="text" token="networkIdOnChange1" searchWhenChanged="false"&amp;gt;
        &amp;lt;label&amp;gt;NetworkID1:&amp;lt;/label&amp;gt;
        &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
      &amp;lt;/input&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;js:  please have onclick method as &lt;CODE&gt;$("#submit_button button").click(function(){&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'jquery',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function($, mvc){
    var button = mvc.Components.get("submit_button");
    $("#submit_button button").click(function(){
         alert("test");
     });

});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://i.ibb.co/dJb7cTs/button.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 17:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392173#M25707</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-07-19T17:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust the click width of a JS button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392174#M25708</link>
      <description>&lt;P&gt;I checked in 7.3.0 its working fine.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 17:13:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392174#M25708</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-07-19T17:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to adjust the click width of a JS button?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392175#M25709</link>
      <description>&lt;P&gt;it worked with this style! thanks a bunch!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 17:22:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-adjust-the-click-width-of-a-JS-button/m-p/392175#M25709</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2019-07-19T17:22:29Z</dc:date>
    </item>
  </channel>
</rss>

