Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Capture Selected ListBox Value in ZFC page

I would like to capture the selected value of a ListBox when a user makes a selection in a zfc htm page. I would then like to use that value as a parameter to pass to an aspx page? Can anyone help me out with this? I have seen the previous threads on this but the answers seem to be archived and unavailable. This is on QVS 8.5.

Thanks for the help.

1 Solution

Accepted Solutions
chrisbrain
Partner - Specialist II
Partner - Specialist II

Hi,

JavaScript along the lines of the following should allow you to inspect a give listbox for the values and associated states of the values. The code might need to be tweaked if your listbox if multi columned but hopefully you get the idea.

<script type='text/javascript'>
function showListBoxValues(lbId)
{
var tblElement = document.getElementById(lbId);
var rows = tblElement.rows;

var res = [];

for(var r = 0; r < rows.length; r++)
{
var td = rows.childNodes[0];

var state = td.className;
var text = td.title;
var value = td.value;

res.push(state + ',' + text + ',' + value);
}

alert(res.join('\n'));

}

</script>
<span onclick='showListBoxValues("LB1468")' >Get Selected Value</span>



beeido.com - BI | Software | Qlik Integration Services
GitFirst - A CI/CD solution for Qlik Sense

View solution in original post

4 Replies
chrisbrain
Partner - Specialist II
Partner - Specialist II

Hi,

JavaScript along the lines of the following should allow you to inspect a give listbox for the values and associated states of the values. The code might need to be tweaked if your listbox if multi columned but hopefully you get the idea.

<script type='text/javascript'>
function showListBoxValues(lbId)
{
var tblElement = document.getElementById(lbId);
var rows = tblElement.rows;

var res = [];

for(var r = 0; r < rows.length; r++)
{
var td = rows.childNodes[0];

var state = td.className;
var text = td.title;
var value = td.value;

res.push(state + ',' + text + ',' + value);
}

alert(res.join('\n'));

}

</script>
<span onclick='showListBoxValues("LB1468")' >Get Selected Value</span>



beeido.com - BI | Software | Qlik Integration Services
GitFirst - A CI/CD solution for Qlik Sense
Not applicable
Author

Hi Rick

What about

<h4>getfieldselections ( FieldName [, ValueSep [, MaxValues]] ) ? </h4><h4>

This returns a string with the current selections in a field but I am not sure whether it will work in a htm page.

Not applicable
Author

This is what I was looking for. Now if I can get the state=="AvqSelected" to work properly.

Thanks, Rick

Not applicable
Author

I was trying to do it on the htm side. I think your solution would be server side.

Thank you for response though.