RemoveDropDownItem method: Field class
Syntax
RemoveDropDownItem(CodeString)Description
The RemoveDropDownItem method removes an item from the drop-down list in the control for the field.
The value that you pass to RemoveDropDownItem identifies the drop-down item to remove. The value is case-sensitive. If the value is longer than the field length of the drop-down field, the system truncates the value for comparison.
Considerations Using RemoveDropDownItem
Note the following considerations:
- RemoveDropDownItem works with both system-generated drop-down lists, which are populated from prompt tables or translate values, and custom drop-down lists created by using AddDropDownItem.
- The changes made by this method are not persisted and remain in effect only while the field exists in the component buffer.
- You can call RemoveDropDownItem from any PeopleCode event. However, a good place for your PeopleCode program to remove a drop-down item is in the RowInit event.
- If the drop-down field is not marked as Required, the system prepends a blank item to the drop-down list. You cannot remove this blank item by using RemoveDropDownItem.
- If the item that you specify is not in the drop-down list, no error occurs.
- You can remove all items from a drop-down list. However, application developers must handle such situations in their code, such as by hiding the field.
- If you remove the currently selected item, the field displays (Invalid Value). The user can still save the page, and the underlying field value remains unchanged.
- If you call RemoveDropDownItem on a PeopleCode field that does not represent a drop-down field, the user interface does not change and no error occurs.
- If a default value is defined for the drop down, RemoveDropDownItem treats it the same as any other drop-down item and removes it when specified.
Parameters
Table 25-1 Parameters and descriptions for the RemoveDropDownItem method
| Parameter | Description |
|---|---|
|
CodeString |
Specify the case-sensitive code string for the drop-down item to remove. For translate table drop-downs, specify the translate value. For prompt table drop-downs, specify the value from the prompt table key field, or from the designated prompt table field when the page field is not a key field on the prompt table. For custom drop-downs, specify the code string that was passed to the AddDropDownItem method when the drop-down item was added. |
Returns
None.
Example
Local Field &fSort1 = GetField(EM_SELPRES_WRK.EM_VCHR_INQ_SORT1);
&fSort1.RemoveDropDownItem("B");
/* Where "B" is one of the translate values for the field EM_VCHR_INQ_SORT1 */Related Topics