Archive

What is the expected behavior for Submit button when inputs have searchWhenChanged=false

SplunkTrust
SplunkTrust

Expected behavior for Submit button in Simple XML Dashboard is to prevent Input changes to be reflected until Submit button is clicked, provided searchWhenChanged for the input/s is/are set to false and they do not have their <change> event handlers defined.

However, when I tested small piece of run anywhere example in 6.6.3 and 7.1.2, Submit button does not seem to enforce the right effect. Whenever input was changed the tokens got the updated values even before clicking on the Submit button. (PS: I also tested for radio input but have not added the code for keeping the example simple).

<form>
  <label>Submit Button Obsolete</label>
  <fieldset submitButton="true">
    <input type="dropdown" token="tokPanel" searchWhenChanged="false">
      <label></label>
      <choice value="1">One</choice>
      <choice value="2">Two</choice>
      <default>1</default>
    </input>
    <input type="time" token="tokTime" searchWhenChanged="false">
      <label></label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
  <row>
    <panel>
      <html>
        <div>form.tokPanel- $form.tokPanel$</div>
        <div>form.tokTime- $form.tokTime.earliest$,$form.tokTime.latest$</div>
        <div>tokPanel- $tokPanel$</div>
        <div>tokTime- $tokTime.earliest$,$tokTime.latest$</div>
      </html>
    </panel>
  </row>
</form>

Requesting Splunk Team to confirm if the Submit button is truly obsolete or not. If so, it would be better to remove Submit button as Input option.
(PS: An <html> <button> would be a better feature for Dashboard, if the same can be provided ;))

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

SplunkTrust
SplunkTrust

Thanks to @snayak_splunk and @rjthibod, this functionality as working as expected. The issue was with my understanding of Submitted Token Model And Default Token Models.

In use cases like the one mentioned in the question, where Submit Button is used and <input>s have searchWhenChanged set to false and also no <change> Event Handler defined, the default token model will get the changed value but submitted token model will not get the changed value until Submit button is clicked.

While value Default Token Model is used to display in <html> panel, value of Submitted Token Model is used to display in <search> result.

With the help of Developer Gadgets app built by Ryan, I was able to test and confirm this expected behavior.

alt text

Refer to following Run Anywhere example with Developer Gadget App installed and code included in the form:

<form stylesheet="developer_gadgets:load.css" script="developer_gadgets:load.js">
  <label>Submit Button Testing</label>
  <fieldset submitButton="true">
    <input type="dropdown" token="tokPanel" searchWhenChanged="false">
      <label></label>
      <choice value="1">One</choice>
      <choice value="2">Two</choice>
      <default>1</default>
    </input>
    <input type="time" token="tokTime" searchWhenChanged="false">
      <label></label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
  <row>
    <panel>
      <html>
        <div>form.tokPanel- $form.tokPanel$</div>
        <div>form.tokTime- $form.tokTime.earliest$,$form.tokTime.latest$</div>
        <div>tokPanel- $tokPanel$</div>
        <div>tokTime- $tokTime.earliest$,$tokTime.latest$</div>
      </html>
    </panel>
  </row>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults
| eval tokenTimeEarliest=$tokTime.earliest|s$, tokenTimeLatest=$tokTime.latest|s$, tokPanel=$tokPanel|s$             
          </query>
        </search>
      </table>
    </panel>
  </row>
</form>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

Motivator

@niketnilay @snayak_splunk @rjthibod So how do you fix this behavior? How do you create an input where searchWhenChanged=false only updates a token upon button submission? Adding <change> does not fix the issue.

https://answers.splunk.com/answers/742451/searchwhenchangedfalse-not-honored-1.html

0 Karma