- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

renanprado96
Path Finder
03-21-2016
10:21 AM
I want to insert the value of a date on a token:
I will choose for INPUT HTML.
Clicking a <button>
, I wanted to set the chosen date in token
<input type="date" id="myDate" name="bday" min="2015-01-02" max="2030-01-02">
<button onclick="setarToken();"> Mostrar data </button>
I made a function like this:
function setarToken(){
var myDateFn = document.getElementById("myDate").value; // Here get the date of INPUT
// And here I have that insert the date(myDateFn) in the token
// Something like
$myToken$ = myDateFn ;
}
Thanks!
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
martin_mueller

SplunkTrust
03-21-2016
10:43 AM
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
martin_mueller

SplunkTrust
03-21-2016
10:43 AM
Use yourTokenModel.set("myToken", myDateFn);
.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
martin_mueller

SplunkTrust
03-22-2016
02:11 PM
If "submitted"
is the ID of your token model, you can load the actual object like this:
mvc.Components.getInstance('submitted', {create: true})
That's assuming you have the splunkjs/mvc
class stored under that name, and it'll create a new token model if that ID doesn't exist yet.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
martin_mueller

SplunkTrust
03-21-2016
02:15 PM
yourTokenModel
is the variable pointing at your token model, containing the tokens of your dashboard.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

renanprado96
Path Finder
03-22-2016
08:19 AM
So in this example, the token model is submitted
?
new SearchManager({
"id": "search1",
"search": "index=_internal sourcetype=$sourcetype$ | head $choices$",
"earliest_time": "$earliest$",
"latest_time": "now",
"preview": true
}, {tokens: true, tokenNamespace: "submitted"});
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

renanprado96
Path Finder
03-21-2016
10:52 AM
what is yourTokenModel? or Token Model?
I did not understand.
Thanks!
