All Apps and Add-ons

2 Sideview Checkboxes without interaction

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>

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.

Champion

Love the way you explain 🙂

0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!