92
Views
12
Comments
How to disable some items in drop down

I have list of drop downs this list contain some of users i want if a user is selected in first row so i can remove it or disable it in the following rows how can i do in outsystems?

2026-03-12 10-32-06
Wahaj Adil

hi @Mohab Esam , hope you're doing well.
You can use a local variable to manage the selected users, and filter dropdown options dynamically.

2025-03-12 07-08-15
Nilesh Trivedi

Hi @Mohab Esam,

Set the "disabled" attribute: For each option you want to disable, set the disabled attribute to true using setAttribute("disabled", "true") 

I found a solution using JavaScript as done in one of the Forge components: 

"EnableDisableDropdownOption_gradout"

For each option to be disabled it set:

ddrId[i].setAttribute("disabled", "true"); 

ddrId[i].setAttribute("style", "color:"+$parameters.fontcolor+";background-color:"+$parameters.backgroundcolor+";");

Hope it helps.

Thank you

2025-04-14 11-22-14
Aditi Saraswat

Hi @Mohab Esam,

You can dynamically filter the options shown in each dropdown based on the selections made in other rows.
To do this, keep a list of all users selected across the rows.
Then, for each dropdown, exclude users who have already been chosen in other rows. 

Thanks.

2023-03-12 08-39-51
Iheb Maatali Riahi

Hi @Mohab Esam ,
You will find working examples below: one demonstrates how to hide the selected element from the second dropdown, and the other shows how to disable it.
Kindly review the attached OML file , and let me know if you need any further updates  



Have a great day !  

DropDownCheck.oml
2023-03-12 08-39-51
Iheb Maatali Riahi

Working Example Link

UserImage.jpg
Mohab Essam

this solution worked with me for only two dropdowns but i have list of dropdowns so how can i handle this @Iheb Maatali Riahi 

2023-03-12 08-39-51
Iheb Maatali Riahi

Hi @Mohab Esam I made some updates to match your needs. Please check the link for a working example that shows hiding or disabling items inside the dropdown list (DDL).
I tried to make it as dynamic as possible — just don't forget to add the specific class " disabled-select" to any new dropdown list you add .

Working Example Link


=> classe Added "disabled-select"



Also, I will attach the OML.
I hope this helps , have a great day ! 

DropDown-updated.oml
2024-10-12 12-11-20
Kerollos Adel
Champion

Hallo @Mohab Esam

  1. Add the onClick Event: You'll need to handle the click event for the items, check whether the item is active, and prevent the selection if it's not.

  2. Prevent Select on Inactive Item: If the item is inactive, clear the selection and return to the default empty select state.

  3. Conditional CSS Styling: Apply styles dynamically based on whether the item is active or not.




https://personal-oqbcw6a2.outsystemscloud.com/disablesomeitemsindropdown/Screen1?_ts=638817062805772043


disablesomeitemsindropdown.oml
2023-03-13 10-26-05
Sriyamini

Hi,

I have created a sample .oml when a user select an option in the first dropdown and that selected user will no longer appear in the second dropdown. Hope it helps. 

Thanks,

Sriyamini.J

RemoveDropdown.oml
2024-12-10 04-40-04
Gitansh Anand

Hi @Mohab Esam, I highly recommend checking out this article OutSystems Reactive— Mutually exclusive Dropdowns by @Dorine Boudryit offers a really interesting approach.

Also @Dorine Boudryit would be great if you could add this article to your profile to make it easier to find. 

Thanks
Gitansh Anand

2021-09-06 15-09-53
Dorine Boudry
 
MVP

@Gitansh Anand ,

agreed, I have been on a bit of a break from OutSystems lately, I'm behind on some of the admin work.

Dorine

2025-04-30 18-21-22
Senthil Nathan A

Hi @Mohab Esam ,

  • Maintain Selected Users List: Create a local variable of type List (e.g., SelectedUserIds : List of Identifier) to keep track of the user IDs already selected in the rows.

  • Update on Change: On the OnChange event of each dropdown, update the SelectedUserIds list to include the selected user ID (and remove any previously selected ID if changed).

  • Filter Dropdown Options per Row:
    When binding the dropdown source (e.g., Users), apply a filter using a local function or expression:
     ListFilter(Users, not SelectedUserIds.Contains(User.Id) or User.Id = CurrentRow.UserId)
    This ensures the current row still shows its selected value even if it’s in the SelectedUserIds 

  • Alternative (Disabling Instead of Removing):
    If you prefer to disable used users instead of hiding them, use IsSelected = SelectedUserIds.Contains(User.Id) in the dropdown and disable the option via conditional formatting (requires a custom widget or JavaScript if needed).

Hope this works.

Thanks,

Senthil

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.