Skip to main content

Display dropdown values via client script

  • April 15, 2024
  • 3 replies
  • 115 views

Forum|alt.badge.img+7

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

Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+28
  • Superhero (Employee)
  • April 15, 2024

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!


Forum|alt.badge.img+7
  • Author
  • Sidekick (Partner)
  • April 15, 2024

HI @Shneor Cheshin 

 

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

 

 

Thanks,

Durga


Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+28
  • Superhero (Employee)
  • April 16, 2024

 @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!