Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

How to allow Drop Down listbox to accept null values/no value

Avatar

Level 1

How do you get a drop down list box to accept null as its value, without "Allowing Custom Text Entry" ?

In other words I want my list box to have values of:

Apple

Orange

Pear

Peach

Null

2 Replies

Avatar

Former Community Member

You can add an entry with a space in it or you can type the word null to represent no selection

Paul

Avatar

Former Community Member

You can have an entry in the list to represent no value ("<none>").

Then you can add an exit script that looks like:

if (this.rawValue === "<none>") {
    this.rawValue = null;
}

This way, when the user selects the "<none>" entry, the value will be set to null when they exit the field.

   John