Forum Discussion

Kara's avatar
Kara
Creator I
8 years ago

Add dropdown values programatticaly?

Hi everyone.. I am trying to write method where i can add drop-down values through program. Can anyone help me to do so?

4 Replies

  • Hi Mily, what version of Aras do you use? For SP9 e.g. you can take a look at my starting page project: github.com/.../cui-select-starting-page Code for filling dropdown list: github.com/.../BPL_SelectStartingPage_onLoad.xml In my case I take the dropdown labels from a predefined 'List', but you can also fill the dropdown manually. This project will not work under SP11/SP12, as the new type-ahead function requires a different approach. I already have a SP11 compatible version of this project, but it is not online yet. Angela
  • Thanks Angela... But i am using Aras 11 sp 12 version.
  • Then try this one:
    // Fill dropdown list in Form with available Starting Page options. Function is called on Form load. 
    
    var inn = new Innovator();
    
    // Get dropdown element from GUI
    var itemTypeDropdownComponent = getFieldComponentByName("Starting_Page");
    
    // Get current start item list values
    var listValues = [];
    var itemTypeDropdownList = [];
    listValues = aras.getListValues("BFDEFE0CEE174B52B8972D49B446B812"); // id of List "StartingPage List"
    for (var i = 0; i < listValues.length; i++) { 
        var value = aras.getItemProperty(listValues, "value");
    	var label = aras.getItemProperty(listValues, "label");
    	itemTypeDropdownList.push({label: label, value: value});
    }
    itemTypeDropdownComponent.component.setState({
    		list: itemTypeDropdownList,
    		value: ''
    	});
    
    return null;
  • Hi Angela, I tried above code and it is working fine. Thanks for your help.   Can i write it for server method?