Populate a select with given values. You can give it a list or take data from a /listdata/tablename call to the server.


- elm | the jquery element holding the select

- ldef | to data to add to the options, can be array of string or array of objects. If your element in the list is a object, you can set data values on the element to tell what key to use for the value and the text in the select. For the value use data-selectvalue="keyforvalue" (default for selectvalue is "value"). For the text use data-selecttext="keyfortext" (default for selecttext is "text")

<select id="myselect" data-selectvalue="id" data-selecttext="ame"></select>
var elm=$("#myselect");
var ldef = [{id:"1",name:"Oslo"},{id:"2",name:"London"}];

Example of element definition and setting the select. This will get two option and show Oslo and London in the dropdown. The values 1 and 2 will be returned depending of which is selected.