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.skuidify.com/skuid/topics/how_do_i_render_custom_picklist_values

And this one: https://community.skuidify.com/skuid/topics/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.skuidify.com/skuid/topics/custom_picklist_renderer_when_option_source_is_a_model