Forum Discussion

team_aras_meupe_com's avatar
3 years ago
Solved

Promote Dropdown dinamically

Hello, I'm trying to fill a dropdown by code. Let me explain, I have a report, which when selected, shows me a screen where the user can select the date range and I would like to put a dropdown with...
null
  • angela's avatar
    3 years ago

    Well, the way to work with dropdowns changed around 3 times over the years. There is a difference between 11SP9, 11SP11 and 11SP15 :). 

    General tip: Always add a comment sections on the top of your code that indicates which version it was build for and add some descriptions.

    This way I found this Innovator 11SP9 code that filled a dropdown in Form based on a List item:

    var inn = new Innovator();

    // Get dropdown element from Form
    var div_startpage = getFieldByName("mydropdown").id;
    var control_items = div_startpage.substring(0, div_startpage.indexOf("span"));
    var select = document.getElementById(control_items);

    // Get  list values
    var listValues = [];
    listValues = aras.getListValues("BFDEFE0CEE174B...."); // id of List "xy"
    for (var i = 0; i < listValues.length; i++) {
    var value = aras.getItemProperty(listValues, "value");
    var label = aras.getItemProperty(listValues, "label");
    var option = document.createElement('option');

    select.options = new Option(label, value); // fill dropdown list
    }

    No Idea if it works :D