Populate select options

I’m trying to build an embedded form using HTML/Javascript with two select boxes, based on the selection in the first select box, the second select box needs to be populated. I tried document.getElementById(“ObjId”) and tried to add options, but it doesn’t work.
Is there some documentation which can point out how to get this done?

Hi Thomas,

I found this tutorial which might help you.

If this does not solve your problem, can you please provide the form you are having trouble with?

KR
Martin

Hi @martin.stamm,

Thanks for your reply. The tutorial covers assigning static option values to the select control. My query was more of how to populate select options in a scenario where the data is present in a database or rest end point call, dynamically.

That works the same way as you would with static options, you just have to fetch the options from the backend and parse them first. Then you can add them like shown in ‘Adding options from an object’

I used angular to overcome this issue.

ng-options=“item.name for item in Items track by item.id”

$scope.Items.push({name: xxxxx ,id: yyyyy})