Splunk Search

fieldset input depends not valid

cdstealer
Contributor

Hi, I'm trying to add conditional form inputs, but I just get an error even though the docs say it's supported??? DOCS

This is an excerpt from the dashboard.

<fieldset>
    <input type="time" token="time" depends="$details_show$" >
      <label>Time Period for Capacity Chart</label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>

And this is the error displayed in the source editor:

Warning on line XX: Unknown attribute "depends" for node "input"

So are the docs incorrect and this isn't supported or am I doing something wrong?

I've tested this on versions 6.5.0 & 6.5.1.

Thanks in advance.
Steve

Tags (1)
0 Karma

frobinson_splun
Splunk Employee
Splunk Employee

This is a known issue in the 6.5.x release and was/is documented here:
http://docs.splunk.com/Documentation/Splunk/6.5.2/ReleaseNotes/KnownIssues

See issue SPL-131452 in this section:
http://docs.splunk.com/Documentation/Splunk/6.5.2/ReleaseNotes/Knownissues#Charting.2C_reporting.2C_...

Please stay tuned for a fix in an upcoming release. You can check our release notes for information on existing issues and a changelog of fixed issues by release.

Hope this helps!

rvany
Communicator
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Looks like a documented feature that doesn't exist to me, I've filed docs feedback to clarify.

In the meantime, you can stick the time input into a panel and have the panel depend on your token as a workaround.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

That's just a matter of a bit of JS:

require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {
    mvc.Components.get('mytable').getVisualization(function(tableView){
        tableView.manager.on("search:done", function() {
            mvc.Components.get("fieldset1").model.controller.trigger("action:hideFilters");
        });
    });
});
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

If all you need is to hide all filters then you can pass hideFilters=true to the dashboard.

0 Karma

ash2l
Path Finder

I want to hide it dynamically and the hideFilters=$token$ would not work if I pass 'true' or 'false' as a token value from search results. I guess because it's the form attribute.

0 Karma

ash2l
Path Finder

Input into a panel does not work either as I have SubmitButton which is a part of fieldset tag. And the fieldset tag can't be a part of panel.

 <fieldset submitButton="true" autoRun="false">

Basically I want the entire input filters including submit button to show up only if the depends token is not null. If the token is null, then everything should hide for the user.

0 Karma

niketn
Legend

In 6.5 Splunk has introduced an init section where token values can be defaulted. On form load you can code init section to unset the token so that your input is not rendered on Dashboard load. Later you can set it through Dashboard events like Search or Input or Visualization Events

  <init>
    <unset token="myToken"></unset>
  </init>
  <fieldset submitButton="false">
    <input type="dropdown" token="selLogLevel" depends="$myToken$">
      <label>Select Log Level</label>
      <choice value="*">All</choice>
      <default>*</default>
      <initialValue>*</initialValue>
      <fieldForLabel>log_level</fieldForLabel>
      <fieldForValue>log_level</fieldForValue>
      <search>
        <query>index=_internal sourcetype=splunkd log_level=*
| dedup log_level
| sort log_level
| table log_level</query>
      </search>
    </input>
  </fieldset>

The above code will not render the dropdown. You can change from unset to set and it will render.

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

ash2l
Path Finder

It obviously works on type="dropdown", but it does not work on type="time" in 6.5.1

Adding init section is not making depends work for time attribute. I still see the time popup on on the screen even though the token is unset. In addition, the warning [ Unknown attribute "depends" for the note "input" ] is still appearing in that line where type="time" is listed.

  <init>
      <unset token="access"></unset>
  </init>
  <fieldset submitButton="true" autoRun="false">
    <input type="time" token="field_date_update" searchWhenChanged="true" depends="$access$">
      <label>Select Date for Update</label>
      <default>
        <earliest>-1d@d</earliest>
        <latest>@d</latest>
      </default>
    </input>
0 Karma

niketn
Legend

I did not notice that it was for time input. I am changing my answers as comment.

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

ash2l
Path Finder

Did you update the previous comment? If yes, I still don't see it reflected yet with "time" input. Would you please reply again?

0 Karma

niketn
Legend

No, I answered expecting issue is with dropdown. I also noticed the same behavior as what you have mentioned with the time control. Have you opened a ticket with Splunk Support. This seems to be a bug unless someone else in the community confirms otherwise.
I just converted my answer to a comment so that it gets highlighted as unanswered question for someone else to assist.

Just curious do you want to display dates or custom time selections like Today, Yesterday, Previous Week etc? Would it be possible for you to provide a dropdown or combinations of text boxes until the issue is resolved for users to provide time?

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

ash2l
Path Finder

Any update on this one? We had been using "depends" attribute in older version 6.3.5 without any issues and now it's not working all of a sudden after upgrading to 6.5.1!

Document says it's still supported - http://docs.splunk.com/Documentation/Splunk/6.5.1/Viz/PanelreferenceforSimplifiedXML

0 Karma

lguinn2
Legend

Where does the token $details_show$ come from? We need to see more. If there is no definition of the token, then that is the problem.

0 Karma

rvany
Communicator

I think, even with the issue present (as in 6.5.2) a "not defined" token is no problem in the "depends" attribute. I use something like 'depends="$neverdefinedanywhere$"' to hide some fields during development without any warning.

0 Karma

cdstealer
Contributor

Hi, Thanks for the reply. I've tried setting it as a token that is defined (help_target) and get the same result. This is the inputs section.

<form>
  <init>
    <set token="help_target_title">NetApp Volume Details</set>
    <set token="help_target">NetAppVolumeDetails</set>
  </init>
  <label>NetApp Volume Details WIP smoyes</label>
  <fieldset submitButton="false" autoRun="true">
    <input type="dropdown" token="system" searchWhenChanged="true">
      <label>System Name</label>
      <search>
        <query>sourcetype="ontap:system" | stats count by system-name</query>
        <earliest>-60m@m</earliest>
        <latest>now</latest>
      </search>
      <change>
        <unset token="Detail_show"></unset>
        <set token="form.aggregate">*</set>
        <unset token="Chart_noshow"></unset>
      </change>
      <fieldForLabel>system-name</fieldForLabel>
      <fieldForValue>system-name</fieldForValue>
    </input>
    <input type="time" token="time" depends="$details_show$">
      <label>Time Period for Capacity Chart</label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
0 Karma

lguinn2
Legend

There is nothing in your XML that defines a token named "details_show" - although there is something that defines "Detail_show"

0 Karma

gokadroid
Motivator

I tried to import the xml given in comment as a dashboard in my local and didn't get the reported "Unknown atttribute" Warning. I am running 6.4.2. As for the token not being defined, the only difference if at all might be that if details_show token is not present or defined, the fieldset input where it is being referred in depends="$details_show$" that fieldset input will never show up in dashboard as token details_show will never be set.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...