Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality
Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
By gbalbach
#828792
Is it possible to sort a dropdown list in Javascript? The code below is from the wiki link posted below. I am reading in a json list that is not sorted correctly and either during or after I use code similar to the example below I want to sort it by the text - the "opt.text = aProducts[1];" value. Is this possible in javascript right after or while I load the drop down list?

https://wiki.processmaker.com/index.php/2.0/Dropdown_Boxes_and_Listboxes#Accessing_Dropdowns_with_JavaScript

var aProducts = eval(getValueById("sProducts"));
if (typeof(aProducts) == 'object' && aProducts.length) { //if an array
for (var i=0; i < aProducts.length; i++) {
var opt = document.createElement("OPTION");
opt.value = aProducts[0];
opt.text = aProducts[1];
getField("selectProducts").options.add(opt);
}
}

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]

Betvisa clone scripts are pre-built software solut[…]

A Bet365 Clone Script is essentially a ready-made […]