Hide certain enum values from users

272 views Asked by At

I am trying to create a dropdown-list where you can select current employees from. However, in order to not invalidate old data, the names of old employees should also be valid entrances for the field. I am new to alpacajs, however i was thinking about doing something like this:

.alpaca({
    "data": "Coffee2",
    "options": {
        "label": "Ice cream",
        "optionLabels": ["", "Chocolate", "Coffee"] //Here i would want e.g. that Vanilla was hidden from the user.
    },
    "schema": {
        "required": true,
        "enum": ["Vanilla", "Chocolate", "Coffee"]
    }
});

This solution however would then make it so you would not see the former employees names on previous data but only " ". I have also thought about doing it with observables, however i cannot get it to work.

1

There are 1 answers

0
Marcos Randulfe Garrido On

You can use de element "disallow": ['property'], to remove the elements from the list