Dashboards & Visualizations

Why does dynamic multiselect search rerun when another input fieldvalue changes?

matstap
Communicator

I have the following dynamic multiselect:

<input type="multiselect" token="carrier">
      <label>Carrier</label>
      <delimiter>, </delimiter>
      <fieldForLabel>CarrierName</fieldForLabel>
      <fieldForValue>CarrierID</fieldForValue>
      <search>
        <query>| inputlookup carrierlist.csv where 
    [| rest /services/authentication/current-context/context 
    | where username !="splunk-system-user" 
    | fields roles 
    | mvexpand roles 
    | join type=inner roles 
        [| inputlookup role_parent_carrier.csv ] 
    | table ParentCarrierID]</query>
      </search>
    </input>

Whenever I change the value of a custom input type, the dynamic search runs again and usually fails. Here is the definition of this custom date picker:

XML:

<input type="text" id="date_earliest" token="earliest">
      <label>Earliest</label>
    </input>
    <input type="text" id="date_latest" token="latest">
      <label>Latest</label>
    </input>

JS:

$("[id^=date]").attr('type', 'datetime-local');

$('#date_earliest').on('change', function(e) {
            var early = getEpoch($('input[id^=date_earliest]').val().replace(/(?<=[0-9])(T)/, " "));
            defaultTokenModel.set('earliest', early);
        });

        $('#date_latest').on('change', function(e) {
            var latest = getEpoch($('input[id^=date_latest]').val().replace(/(?<=[0-9])(T)/, " "));
            defaultTokenModel.set('latest', latest);
        });

Why are the .on('change'...) calls causing the search to run again?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...