Dropdown

Lets the user choose a value from a dropdown filled with predefined values.

The values can be combined with friendly labels, and in that case
the labels will be displayed to the user instead of the value.

Start value: The value that is preselected in the list.
Return value: The value that is selected in the list (not the displayed value).
Supported in: NewEdit Parameter page Multirow Editable Grid

Appearance

alt text
In its closed state, the user can still select an item in the list using the keyboard. When the dropdown control has keyboard focus, typing a key will choose the entry that starts with that character (rapidly typing a whole sequense also works). The user can also navigate in the list with the Up/Down arrows, PgUp/PgDown and Home/End buttons.


alt text
The user can choose among the list's items using mouse or keyboard, but cannot enter any value not in the list.

SQL

SQL Call: Get options

Returns the options.

May modify database: No

Resultset: Options

The options users can choose from.

Table count: repeated exactly once
Row count: zero or more rows
Columns
<column with ordinal 1> mandatory string

ID value.

<column with ordinal 2> optional string

Label shown in the dropdown.

Default: If this column is omitted the ID is also used as label.
HideUnlessCurrent optional bit
This column indicates that the value should only be shown in the list if it is the currently chosen value.
InfoHtml optional string
Extra informative HTML to display below the field. This is not supported in multirows.
InfoText optional string
Extra informative text to display below the field. This is not supported in multirows.
OptionGroup optional string

When using this column, all options with the same OptionGroup will be grouped together under a heading labeled with the OptionGroup value.

Default value

SQL Call: Default value

Retrieves the default value for the control.

May modify database: No

Resultset: Default value

Table count: repeated exactly once
Row count: exactly one row
Columns
<column with ordinal 1> mandatory string
The default value

Validation

SQL Call: Validation

This call is only made if there is a field validation set for the field info and the field has any content.

Live Validation

Performs field validation when the user leaves the field or one of its dependencies is changed, initial values set by default value and initial values in edit-mode are not validated.

Save Validation

When saving the validation runs server side if the field value has changed. A field value is considered changed if in new mode the value is anything other than NULL. In edit mode it is considered changed if it has a value that was not returned by the GetEditFields procedure.

May modify database: No

Parameters

@Value string
The value of the field, the procedure will not be called if value is NULL.

Resultset: Validation messages (optional)

Table count: repeated zero or one time
Row count: zero or one row
Columns
Error optional string
Error message to display. Blocks the user from saving.
Info optional string
Informative message to display. Does not block saving.
Warning optional string
Warning message to display. Does not block saving.

Best practice

Always use an explicit ORDER BY

For stable and predictable behaviour, always use an explicit ORDER BY clause.

Name of stored procedure

The name depends on the usage. If the control is used to retrieve values from a lookup table then the procedure should be named "<Schema>.<LookupTable>Dropdown". If it is not and the values are not directly linked to rows in a table or the functionality is specific for the current field (say for instance a choice between each of the last six years) then the procedure should be named "<Schema>.<Table><Field>_Dropdown".

HideUnlessCurrent

The use of "HideUnlessCurrent" is meant to quickly provide a description for the current value in a dropdown, even when the value otherwise is not selectable in the stored procedure. Use freely when you only have small number of rows (less than 100). But if you have large amounts of inactive rows it will have an impact on performance. If you do, it's preferable to handle the missing id separately instead.