Dashboards & Visualizations

How to use link list option as a plus button

hrs2019
Path Finder

my Requmient is
After entering the URL details in the text box, if the user selects the plus button(right side +) it ll update in the below table.
Users have the option to enter URL up to 5 times.
Can anyone pls suggest some solution.
Below is the code what I am using

<form theme="dark">
<label>Text Box Validation</label>
<search>
<query>| makeresults
| eval url="$url$"
| eval url_count=split(trim(url),",")
| rex field=url "(?&lt;url_type&gt;(https|http))" max_match=0
| eval boolValidationURLCount=case(mvcount(url_count)&lt;=5,"true",true(),"false")
| eval boolValidationURLCondition=case(url_type="https" AND url_type!="http","true",true(),"false")</query>
<earliest>$earliest$</earliest>
<latest>$latest$</latest>
<done>
<condition match="$result.boolValidationURLCount$==&quot;true&quot; AND $result.boolValidationURLCondition$==&quot;true&quot;">
<set token="tokValidURLs">$result.url$</set>
</condition>
<condition match="$result.boolValidationURLCount$==&quot;false&quot; AND $result.boolValidationURLCondition$==&quot;false&quot;">
<set token="tokValidationError">Only upto 5 URLs allowed. URL must start with https</set>
<unset token="tokValidURLs"></unset>
</condition>
<condition match="$result.boolValidationURLCount$==&quot;false&quot; AND $result.boolValidationURLCondition$==&quot;true&quot;">
<set token="tokValidationError">Only upto 5 URLs allowed.</set>
<unset token="tokValidURLs"></unset>
</condition>
<condition match="$result.boolValidationURLCount$==&quot;true&quot; AND $result.boolValidationURLCondition$==&quot;false&quot;">
<set token="tokValidationError">URLs must start with https</set>
<unset token="tokValidURLs"></unset>
</condition>
</done>
</search>
<fieldset submitButton="false"></fieldset>
<row>
<panel>
<!-- <html>
<a class="btn btn-primary" align="right" role="button" style="position:absoluate; left:0.0%;">+</a>
</html>-->
<input id="splunk_input_text_url" type="text" token="url" searchWhenChanged="true">
<label>Enter Upto 5 URLs (https ONLY)</label>
<default>https://www.facebook.com</default>
</input>
<input type="link" id="buton" token="plusbutton">
<label></label>
<choice value="+">+</choice>
</input>
</panel>
</row>
<row>
<panel>
<html rejects="$tokValidURLs$">
<style>
#splunk_input_text_url{
width: 1220px !important;
}
#buton{
width: 50px !important;
}
</style>
<div>
<b style="color:red">$tokValidationError$.</b>
</div>
<div>
Please validate input <b style="color:red">$url$</b>!!!
</div>
</html>
<table depends="$tokValidURLs$">
<title>Table with valid URLs</title>
<search depends="$tokValidURLs$">
<query>| makeresults 
| fields - _time 
| eval URL="$tokValidURLs$" 
| makemv URL delim="," 
| mvexpand URL 
| rex field=URL "(?&lt;URL_Type&gt;(https|http))"
| table URL, URL_Type</query>
<earliest>$earliest$</earliest>
<latest>$latest$</latest>
</search>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">true</option>
</table>
</panel>
</row>
</form>

1000.JPG 

Labels (3)
Tags (2)
0 Karma

niketnilay
Legend

@hrs2019 the expected behavior for + link input button has not be clearly described in your question. On click of + button, do you want to add selected text box values to the table?

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

hrs2019
Path Finder

@niketnilay  thanks for your reply.
Yes, I want to add selected text box values to the table one by one up to five rows.
like-
1. https://www.app1.com
2. https://www.app2.com
3. https://www.app3.com
4. https://www.app4.com
5. https://www.app5.com

And each time  On click of + button selected text box values will add to the table and after that tex box Token Reset.

For Text Box Token Reset I was referring your one solution but stuck in between.
post link-
https://community.splunk.com/t5/Archive/How-do-you-reset-a-dashboard-field-after-hitting-the-submit/...
Can you pls suggest how I can achieve that.
Please let me know if you need any other details.
Thank you so much for all the Splunk answers solutions that are provided by you.
textbox.JPG

0 Karma

niketnilay
Legend

@hrs2019 sorry still not clear. Possibly because screenshot does not explain the details you have typed.

When you start, will you have up to 5 URLs in the Text Box (comma separated).

Then when you click on Plus one URL will be popped from Text Box and will appear as a row in the table.

So on till last URL is removed from Text Box to Table?

What will you do when someone pops one URL from Text Box to table and then adds one more URL to Text Box, will that be allowed and if so you may have more than 5 URL set from the Text Box.

Since seems like you are trying to build a lot of custom Client Side capabilities which are not direct straightforward implementation using Simple XML, I would request have a Web Developer code all the required behavior using Simple XML JS extension.

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

hrs2019
Path Finder


@niketnilay  Thankyou so much for your reply.
When I am Popping one URL from text box to table the token value in the text box is not getting refreshed and the same value remains there, I want to remove the token value once it's added to the table and I want to use up to 5 URLs( 5 rows).

Here are my inline comment 
1. When you start, will you have up to 5 URLs in the Text Box (comma separated).
 No one by one I need to enter. up to by URLs.
2. Then when you click on Plus one URL will be popped from Text Box and will appear as a row in the table.
Yes
3. So on till the last URL is removed from Text Box to Table?
yes.

0 Karma
Take the 2021 Splunk Career Survey

Help us learn about how Splunk has
impacted your career by taking the 2021 Splunk Career Survey.

Earn $50 in Amazon cash!