Hello @sarumjanuch and @harshpatel,
Right now I don't have full solution implemented but what you can do is:
$(document).ready(function() {
$(".splButton-primary").on("click", function(e){
and add code to read the selected value from the dropdown and put that value in textField-2Hope this helps to understand the flow how you can implement it.
This works. Here is my application.js and setup.xml file for anyone else fighting with this. Splunk please add support... it's a lot of work for a list...
The only other thing is to make sure your default/my_app.conf file has the list values for your placeholder. Hope this helps.
$(document).ready(function() {
auth_type_placeholder_div_id = "item-/my_app_setup/my_app_1/my_app_1/authentication_type_placeholder"
auth_type_input_id = "/my_app_setup/my_app_1/my_app_1/authentication_type_id"
auth_type_id = "/my_app_setup/my_app_1/my_app_1/authentication_type_id"
auth_type_placeholder_id = "/my_app_setup/my_app_1/my_app_1/authentication_type_placeholder_id"
// hide the auth inputs auth inputs
document.getElementById(auth_type_placeholder_div_id).style.display='none'
document.getElementById(auth_type_input_id).style.display='none'
// convert the values in placeholder (comes from default/my_app.conf) to an array for the select
list_of_values = document.getElementById(auth_type_placeholder_id).value.split(',')
// create a select with the auth input is
auth_div = document.getElementById(auth_type_input_id)
frag = document.createDocumentFragment()
select = document.createElement("select")
select.id = "auth_type_select"
select.style.visibility='visible'
for (index = 0; index < list_of_values.length; index++) {
select.options.add(new Option(list_of_values[index]))
}
frag.appendChild(select)
auth_div.parentNode.insertBefore(frag, auth_div.nextSibling);
// select the current value
select.value = document.getElementById(auth_type_id).value
});
$(".splButton-primary").on("click", function(e){
// get the value of the selection
document.getElementById(auth_type_id).value = document.getElementById('auth_type_select').value
});
<setup>
<block title="my_app Credentials" endpoint="my_app_setup/my_app_1" entity="my_app_1">
<input field="username">
<label>Username*</label>
<type>text</type>
</input>
<input field="password">
<label>Password*</label>
<type>password</type>
</input>
<input field="authentication_type_placeholder">
<label>hidden field to get auth values,native,basic,form</label>
<type>text</type>
</input>
<input field="authentication_type">
<label>my_app Authentication</label>
<type>text</type>
</input>
</block>
</setup>
@sarumjanuch , Any updates? Did you find any answer?
I don't believe that lists were ever fully implemented in setup.xml. You could fake it by including your own JavaScript though.
That is actualy waht i did. If someone need, i cant post it here.
Hi Sarumjanuch,
can you please post your solution?