All Apps and Add-ons

2 Sideview Checkboxes without interaction

norbert_hamel
Communicator

Hi all,

I have 2 sets of checkboxes in my dashboard, each one pre-populetd using ValueSetter like the example below.

When I select some of the boxes in the 2nd set and after that change selection in 1st set, the 2nd set is reset to pre-populated values.

How can I keep the selection from 2nd set when 1st set is changed?

Thanks and Happy New Year!
Norbert

<module name="ValueSetter"  autoRun="True">
<param name="name">TRANS_TYPE_ID_Token</param>
<param name="delim">,</param>
<param name="value">2,3</param>
<module name="Checkboxes"  layoutPanel="panel_row1_col1_grp1">
    <param name="name">TRANS_TYPE_ID_Token</param>
    <param name="staticCheckboxes">
        <list>
            <param name="label">Label-1</param>
            <param name="value">1</param>
        </list>
        <list>
            <param name="label">Label-2</param>
            <param name="value">2</param>
        </list>
        <list>
            <param name="label">Label-3</param>
            <param name="value">3</param>
        </list>
    </param>
    <param name="separator">+OR+</param>
    <param name="template">TRANS_TYPE_ID=$value$</param>
    <param name="outerTemplate">( $value$ )</param>

    <module name="ValueSetter"  autoRun="True">
        <param name="name">STATUS_ID_Token</param>
        <param name="delim">,</param>
        <param name="value">1,2</param>
        <module name="Checkboxes"  layoutPanel="panel_row1_col1_grp2">
            <param name="name">STATUS_ID_Token</param>
            <param name="staticCheckboxes">
                <list>
                    <param name="label">Label-1</param>
                    <param name="value">1</param>
                </list>
                <list>
                    <param name="label">Label-2</param>
                    <param name="value">2</param>
                </list>
                <list>
                    <param name="label">Label-3</param>
                    <param name="value">3</param>
                </list>
            </param>
            <param name="separator">+OR+</param>
            <param name="template">STATUS_ID=$value$</param>
            <param name="outerTemplate">( $value$ )</param>

sideview
SplunkTrust
SplunkTrust

Well the standard way to determine default selection for a Checkboxes module is to just put

<param name="selected">True</param>

into the appropriate staticCheckboxes entries. Thus your XML becomes:

<module name="Checkboxes"  layoutPanel="panel_row1_col1_grp1" autoRun="true">
  <param name="name">TRANS_TYPE_ID_Token</param>
  <param name="staticCheckboxes">
      <list>
        <param name="label">Label-1</param>
        <param name="value">1</param>
      </list>
      <list>
        <param name="label">Label-2</param>
        <param name="value">2</param>
        <param name="selected">True</param>
      </list>
      <list>
        <param name="label">Label-3</param>
        <param name="value">3</param>
        <param name="selected">True</param>
      </list>
  </param>
  <param name="separator">+OR+</param>
  <param name="template">TRANS_TYPE_ID=$value$</param>
  <param name="outerTemplate">( $value$ )</param>


  <module name="Checkboxes"  layoutPanel="panel_row1_col1_grp2">
    <param name="name">STATUS_ID_Token</param>
    <param name="staticCheckboxes">
      <list>
        <param name="label">Label-1</param>
        <param name="value">1</param>
        <param name="selected">True</param>
      </list>
      <list>
        <param name="label">Label-2</param>
        <param name="value">2</param>
        <param name="selected">True</param>
      </list>
      <list>
        <param name="label">Label-3</param>
        <param name="value">3</param>
      </list>
    </param>
    <param name="separator">+OR+</param>
    <param name="template">STATUS_ID=$value$</param>
    <param name="outerTemplate">( $value$ )</param>

This will completely fix your problem. Checkboxes docs are pretty light in that it just tells you to go refer to all the Pulldown docs because the mechanisms are the same, and then the Pulldown docs call out the <param name="selected">True</param> method of preselecting static pulldown options.

While ValueSetter can be used to prepopulate pretty much anything, for staticCheckboxes it's a secondary method and here in this view it has the side effect you mention. With each push through the second ValueSetter, the second Checkboxes receives a new and unequivocal instruction to select itself to the original selections. To illustrate another way to address the problem, you could also move the second ValueSetter upstream, so it looked like

ValueSetter
  ValueSetter
    Checkboxes
      Checkboxes

This would effectively fix your problem too, and it's what you would do if you had to prepopulate dynamic checkboxes, but if you have only static ones then the first solution is a lot simpler.

Another Very Important Point

you're nesting a module with an autoRun="True" attribute downstream from another module with an autoRun="True". Never do that. It can cause very confusing bugs and slow page loading. Autorun just tells the page loading code whether and where to start a downstream push. Since all pushes cascade all the way downstream there is no reason to ever nest one inside the other. If you've ever fought mysterious bugs where some sets of $foo$ tokens in your page seemed to be undefined at page load, then you've experienced these bugs. Find all your extra autoRun's and remove them. Factor the remaining autoRun's up onto the higher module - typically the top module in a chain of form element modules.

linu1988
Champion

Love the way you explain 🙂

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Laser Bananas and Edge Hubs: Exploring Operational Technology (OT) Data Through a ...

  OT is a different environment to traditional IT and can have interesting challenges when interfacing the ...

Event Series: Mastering AI Tokenomics and Splunk Agent Observability

Beyond the Black Box: Correlating AI Performance and Tokenomics with Splunk Agent Observability   As ...

span_metrics: The OpenTelemetry-Idiomatic Way to See Inside Your Services

You open a trace in Splunk Observability Cloud and everything looks fine. One root span, order-pipeline, with ...