- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to select all checkboxes in a form input by default?
![mclane1 mclane1](https://community.splunk.com/legacyfs/online/avatars/405251.jpg)
Hello,
I would like to know how select by default all checkboxes in input like this:
<input type="checkbox" token="hosts" searchWhenChanged="true" depends="somethig">
<label>host filter</label>
<search>
<query>* myFilter...
| stats by host
| table host
| sort host</query>
<earliest>$time_tok.earliest$</earliest>
<latest>$time_tok.latest$</latest>
</search>
<fieldForLabel>hosts</fieldForLabel>
<fieldForValue>host</fieldForValue>
<prefix>(</prefix>
<valuePrefix>LIKE(host,"</valuePrefix>
<valueSuffix>")</valueSuffix>
<delimiter> OR </delimiter>
<suffix>)</suffix>
</input>
I found that but, not friendly usage for client.
<input type="checkbox" token="hosts" searchWhenChanged="true" depends="somethig">
<label>host filter</label>
<search>
<query>* myFilter...
| stats by host
| table host
| sort host</query>
<earliest>$time_tok.earliest$</earliest>
<latest>$time_tok.latest$</latest>
</search>
<fieldForLabel>hosts</fieldForLabel>
<fieldForValue>host</fieldForValue>
<default>%</default>
<choice value="%">All</choice>
<prefix>(</prefix>
<valuePrefix>LIKE(host,"</valuePrefix>
<valueSuffix>")</valueSuffix>
<delimiter> OR </delimiter>
<suffix>)</suffix>
</input>
For this result :
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
![cb_usps cb_usps](https://community.splunk.com/legacyfs/online/avatars/357327.jpg)
In it's simplest form, you use a comma separated list:
<input type="checkbox" token="field1">
. . .
<initialValue>a,b,c</initialValue>
</input>
In your case where you have a dynamically generated list, unless your host list does not change often, the only choice you have is to call the URL of the form with the checklist pre-populated, e.g.
I do this myself (with subsets of my entire host list), but I use multiselect instead of checkboxes - not sure if the URL syntax is the same or not. Here's how I build the URL dynamically:
<panel>
<html>
<div> <a href="your_dashboard_name?form.hosts=$hosts$" target="_blank">Name of URL in First Dashboard</a> </div>
</html>
</panel>
The $hosts$ token in this code block is the token name of the multiselect in the first dashboard.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi;
Try this
<input type="checkbox" token="hosts" searchWhenChanged="true" depends="somethig">
<label>host filter</label>
<search>
<query>* myFilter...
| stats by host
| table host
| sort host</query>
<earliest>$time_tok.earliest$</earliest>
<latest>$time_tok.latest$</latest>
</search>
<fieldForLabel>host</fieldForLabel>
<fieldForValue>host</fieldForValue>
<default></default>
<choice value="*">All</choice>
<prefix>(</prefix>
<valuePrefix>host="</valuePrefix>
<valueSuffix>")</valueSuffix>
<delimiter> OR </delimiter>
<suffix>)</suffix>
</input>
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
![mclane1 mclane1](https://community.splunk.com/legacyfs/online/avatars/405251.jpg)
Hello,
Thanks for this post. I have seen this solution (my post) but not user friendly.
I don't want other checkbox, just all checkbox unknown checked.
Thanks
Not possible ? End user just would like to unckeck box.
![](/skins/images/53C7C94B4DD15F7CACC6D77B9B4D55BF/responsive_peak/images/icon_anonymous_message.png)