How can I disallow the entry of arbitrary value in a dropdown cell?

Hello!

I would like to limit the input text to the options in the dropdown. Currently, for example, I am still able to enter any text I want in the cell. On the screenshot below I have entered yarrrr!!! in the cell with the color options, but what I want is to only let the user input the values from the drop, no arbitrary text allowed. Is that possible?

It is possible, but you would need to create a custom editor.

I do not have any similar example for a cell editor but if you would need any additional information I’m here to help.

1 Like

@self , @anton , @aleksandra_budnik

It depends on what exactly you mean/will accept by “but what I want is to only let the user input the values from the drop, no arbitrary text allowed”.

If you mean actually prevent user typing anything, then it may require a custom editor like @aleksandra_budnik says.

But if (like me) you are satisfied that the user can type characters — which is just used to match against the available choices — but ultimately can only accept one of the available choices: Then are you aware of:

  {
    "type": "dropdown",
    "allowInvalid": false,
    "source": [
      "BMW",
      "Chrysler",
      "Nissan"
    ]
  },

Note the allowInvalid: false. From my own documentation:

"type": "dropdown" is equivalent to: "type": "autocomplete", "filter": false, "strict": true, i.e.dropdown list of choices, typing in leaves all choices available, typing in something not in the list makes the cell invalid. Other options from autocomplete may be applied: source for the array of choices, and possibly setting allowInvalid to false.

allowInvalid: Only relevant when strict is set to true. Normally, a strict autocomplete will still allow the entry of a value not among the choices, but the cell will be shown as invalid. Setting allowInvalid to false makes it not accept an invalid value at all.

It’s not as nice as not actually letting the user type the characters in the first place, but at least it makes arbitrary text an invalid choice. User is then left in the cell till they pick something legal or abandon & revert.

1 Like

Thanks, @jon allowInvalid is exactly what I needed!

1 Like

Hi @jon

I took 2 weeks off and really appreciate all your help when I was gone.

Hi @aleksandra_budnik,

Why, thank you! But I only answered two questions while you were away :slight_smile: Hope you had a nice break!

I appreciate people that want to help others and share their knowledge.

Thank you. I was actually moving from one place to another so no break for me. But I am back and ready to answer all the questions that may come :slight_smile: