Display dropdown values via client script

  • 15 April 2024
  • 3 replies
  • 24 views

Badge +6
  • Do Gooder (Partner)
  • 10 replies

Hi All,

when i am trying to display drop down values via client script getting empty values in the dropdown column .I have added the script in events after data load. Even  tried with only “setControlOptions('task_steps', 'user_def10', ‘PASS’)” but still same no value displayed in the screen.

Kindly suggest the way to populate the dropdown values via CS and correct me if i did any thing wrong in below code.

 

var emptyOptions = [];
var options = createCodeTableOption('','');
arrayPush(emptyOptions, options);
setControlOptions('task_steps', 'user_def10', emptyOptions);
    var opt1 = []; 
     
    arrayPush(opt1, createCodeTableOption('PASS','Pass'));
    arrayPush(opt1, createCodeTableOption('FAIL','Fail'));
    arrayPush(opt1, createCodeTableOption('NA','N/A'));
 
    setControlOptions('task_steps', 'user_def10', opt1);     

 

Thanks,

Durga


3 replies

Userlevel 6
Badge +26

Hi @Durga 

Looks like a few redundant steps. Try the following

var opt1 = []; 

arrayPush(opt1, createCodeTableOption('PASS','Pass'));
arrayPush(opt1, createCodeTableOption('FAIL','Fail'));
arrayPush(opt1, createCodeTableOption('NA','N/A'));

setControlOptions('task_steps', 'user_def10', opt1);
return;

Cheers!

Badge +6

HI @Shneor Cheshin 

 

I have  followed same steps but still same not able to see the values in the dropdown .

 

 

Thanks,

Durga

Userlevel 6
Badge +26

 @Durga 

I was not aware this is a list control you are trying to populate.

What I can recommend is:

  1. Use a lookup control instead of a dropdown
  2. Try using the ‘Row’ functions such as ‘setRowControlValue()’

While I am confident that a lookup will work, the second option needs to be further investigated and checked if feasible.

Cheers!

Reply