I managed to do it with Select as written here
I put my results in a HashMap and then:
Map<String, String> availble_batches = new HashMap<String, String>();
ObjectValue batchesDataValue = Variables.objectValue(availble_batches)
And I have a simple html form with a Select tag
<select cam-variable-name="Selected_Batch" cam-variable-type="String" cam-choices="Available_Batches"/>
My question now is how can I populate values (also taken from DB) to various text fields on the same form depending on the selected value of the dropdown list?
Actually, how do I call a JavaDelegate code from an html form?