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);
}
}

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]