Getting Data In

How to get checkboxgroup django binding to accept multiple inputs?

hp1
Engager

So I have the following django binding for my checkboxgroup input.

{% checkboxgroup id="checkbox_interface" managerid="search_port_id" labelField="interfaces" valueField="interfaces" prefix="(" delimiter=" OR " suffix=")" value="$int_name$"|token_safe %}

When I have more than one option selected, it's suppose to create following value: "(option1 OR option2 OR option3)", but it's not working. Instead it produces "option1, option2, option3" and my search produces no result.

Is there something I'm doing wrong? Any suggestions?

0 Karma
1 Solution

hp1
Engager

So I just ended up using javascript to achieve what I want.

var check = splunkjs.mvc.Components.getInstance("checkbox_interface");
var tokens = mvc.Components.getInstance("default");

check.on("change", function() {
    var s = check.val().join(" OR ")
    tokens.set("int_name", s);
});

Not sure if I want to call this solution or workaround, cause if I use simple xml as below, it does work without additional code.

<input type="checkbox">
      <prefix>(</prefix>
      <suffix>)</suffix>
      <delimiter> OR </delimiter>
    </input>

View solution in original post

0 Karma

hp1
Engager

So I just ended up using javascript to achieve what I want.

var check = splunkjs.mvc.Components.getInstance("checkbox_interface");
var tokens = mvc.Components.getInstance("default");

check.on("change", function() {
    var s = check.val().join(" OR ")
    tokens.set("int_name", s);
});

Not sure if I want to call this solution or workaround, cause if I use simple xml as below, it does work without additional code.

<input type="checkbox">
      <prefix>(</prefix>
      <suffix>)</suffix>
      <delimiter> OR </delimiter>
    </input>
0 Karma
Get Updates on the Splunk Community!

Now Available: Cisco Talos Threat Intelligence Integrations for Splunk Security Cloud ...

At .conf24, we shared that we were in the process of integrating Cisco Talos threat intelligence into Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Easily Improve Agent Saturation with the Splunk Add-on for OpenTelemetry Collector

Agent Saturation What and Whys In application performance monitoring, saturation is defined as the total load ...