---
title: "Prevent a select list from displaying certain options"
canonical: "https://support.appfire.com/space/PSJ/15482297/Prevent%20a%20select%20list%20from%20displaying%20certain%20options"
format: markdown
---
> Macro (aura-html)


Video shows how to restrict certain options from showing up. This is pretty simple and an actual use case would require some additional code to restrict certain options based on some logic.


The code below will limit the # of selections a user can make to three.

### Watch Script

This scripts watches `customfield_10711` and if a change is detected it runs the script `Screen_Listeners/LimitNumberOfSelections.sil`.

```
lfWatch("customfield_10711", {"customfield_10711", "key"}, "Screen_Listeners/LimitNumberOfSelections.sil", "change");   
```

### Hook Script

This script is called by a screen listener `Screen_Listeners/LimitNumberOfSelections.sil` and is run when a change to `customfield_10711` is detected This script will only allow a user to select three boxes in a checkbox list.

```
string [] c = argv["customfield_10711"];
if(arraySize(c) > 2) {  
    c = deleteElementAt(c, 3);
    lfSet("customfield_10711" , c);
}
```