Focal Point
[CLOSED]limit number of selected items on combo Box

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6807004386

August 11, 2016, 12:13 PM
NeilWEST
[CLOSED]limit number of selected items on combo Box
Hi all,
I have a combo box that holds a long list of names. May I know how can limit the number of items selected on a Combo Box in Web Focus.

Thanks!!!

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8
Windows, All Outputs
August 11, 2016, 01:23 PM
Squatch
Assuming your combobox has unique identifier "combobox1", and you want no more than 3 selections, update your window_onload function like so:

function window_onload() {

UpdateData();

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports

$('#combobox1').on('change', function() {
    var $sel = $(this).find(':selected');
    if ($sel.length < 4) {
        $sel.addClass('selected');
        $(this).find(':not(:selected)').removeClass('selected');
    } else
        $(this).find(':selected:not(.selected)').prop('selected', false);
});

}



App Studio
WebFOCUS 8.1.05M
Windows, All Outputs