Page 1 of 1

Dropdown value disable

Posted: Mon May 06, 2019 1:42 am
by HeshanKaru1994
Is there a way to manually disable dropdown values using triggers using pm table data.

Re: Dropdown value disable

Posted: Tue May 07, 2019 1:13 am
by amosbatto
If you set the datasource property of the dropdown to "array variable", then in your trigger, you can eliminate options from the array variable which is used to populate the dropdown's list.
Code: Select all
@=myDropdownList = array(
   array('value1', 'label1'),
   array('value2', 'label2'),
   array('value3', 'label3'),
);
//eliminate second option:
unset(@=myDropdownList[1]);

See: https://wiki.processmaker.com/3.0/DynaF ... iable[code]

If you want the option to appear in the dropdown box, but it is disabled (ie, grayed out), you will need to use JavaScript like this:
Code: Select all
$("#selectColor").find("option[value='red']").prop("disabled", true);
where "selectColor" is the dropdown's ID and "red" is the value of one of its options.

Or you can use this code to disable the second option in the list:
Code: Select all
$("#selectColor").find("option").eq(1).prop("disabled", true);
If you want to remove options from the list, then see:
https://www.pmusers.com/index.php/Chang ... tions_list