defaulting picklist value

Hi,

I am trying to defaulting a value in the picklist with the JavaScript.


var params = arguments[0],
$ = skuid.$;

var result=document.getElementById(“PicklistId”);
result.options[1].selected = true;
result.options[1].defaultSelected = true;

But it is not working. Can any one please fix it. 

Thanks.


Hi Arjun,

I just started using Skuid, Hope this helps.

var field = arguments[0], value = skuid.utils.decodeHTML(arguments[1]),
$ = skuid.$;
    
    var dataTypes = ;
    dataTypes.push({
        active: true
        ,defaultValue: true
        ,label : ‘–None–’
        ,value : ‘’
    });

Goutham, thanks for your reply. Your code is not working.

Arjun,

Give this thread a read: https://community.skuid.com/t/how-do-i-render-custom-picklist-values

And this one: https://community.skuid.com/t/using-a-custom-renderer-to-conditionally-set-a-picklists…

I think between the two you should be able to piece it together.

Actually, this one is even better: https://community.skuid.com/t/custom-picklist-renderer-when-option-source-is-a-model