Please help us by completing this surveyGo to survey
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.
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.
<Options> <Enum type="SenseNet.Search.FilterStatus" resourceClass="MyResourceClassName" /> </Options>
In that case, you do not have to modify the CTD to localize the options of the field.
Usage in CTD:
<Field name="Data1" type="Choice"> ... <Configuration> <Options> <Option value="1" selected="true">value 1</Option> <Option value="2">value 2</Option> ... </Options> </Configuration> </Field>
The following properties can be set in the field’s configuration:
Fully featured example:
<Field name="Style" type="Choice"> <DisplayName>Style</DisplayName> <Description>This field contains the style of the car</Description> <Configuration> <AllowMultiple>false</AllowMultiple> <AllowExtraValue>true</AllowExtraValue> <Options> <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> </Options> <DisplayChoices>RadioButtons</DisplayChoices> </Configuration> </Field>
The above example configures the Choice field so that:
Is something missing? See something that needs fixing? Propose a change here.