Please help us by completing this survey

Go to survey

Docs / Concepts / Choice Field

Choice Field

Choice Field is a multi-purpose field used to allow the user to choose one or more options. It can be rendered as a select tag, radio buttons, or checkboxes.

Choice field as a dropdownlist can be used just the same as a common html select. The options could have the standard properties like selected, disabled, label and value. Value and label properties and the text of the option could be localized.

The chosen option is indexed in the fulltext index by all its localized values and texts (so you can search by either value or text) and indexed in field index by its value. If you want to sort list items by a choice field, they will be ordered by the selected options value and the items with extravalue will be at the end of the list.

Enum options

Besides providing the values manually, the choice field can also be built up using an Enumeration defined in source code. For the manual example see the CTD fragment below.

  <Enum type="SenseNet.Search.FilterStatus" resourceClass="MyResourceClassName" />

In that case, you do not have to modify the CTD to localize the options of the field.

Field handler

Usage in CTD:

   <Field name="Data1" type="Choice">
          <Option value="1" selected="true">value 1</Option>
          <Option value="2">value 2</Option>

Supported Field Controls


The following properties can be set in the field’s configuration:


Fully featured example:

<Field name="Style" type="Choice">
      <Description>This field contains the style of the car</Description>
          <Option value="Sedan" selected='true'>Sedan</Option>
          <Option value="Coupe">Coupe</Option>
          <Option value="Cabrio">Cabrio</Option>
          <Option value="Roadster">Roadster</Option>
          <Option value="SUV">SUV</Option>
          <Option value="Van">Van</Option>

The above example configures the Choice field so that:

Is something missing? See something that needs fixing? Propose a change here.