You can use selection lists in text boxes, which improves their usability.
A text box that has a reference type, such as Warehouse or Employee, by default includes a selection button that opens the selection form for a referenced object.
You might need to implement a similar selection from a set of predefined values for fields of other types.
Let us review a very simple example where a user needs to enter customer addresses starting with city names.
In Designer mode
Let us add a selection list to a text box.
- In Designer, open the configuration object editor of the Customers catalog.
- On the Data tab, add the Address attribute of the String type with length 25.
- Open the Customers catalog item form.
- Expand its main Object attribute and drag the Address field from the attributes pane to the form controls pane.
- In the property palette that is opened, set the ListChoiceMode check box.
- In the ChoiceList field, click the selection button and then use the Add button to add cities: New York, New Rochelle, and Boston (fig. 27.24).
Fig. 27.24. Creating a selection list for a text box
In 1C:Enterprise mode
Let us test the text box.
- Start 1C:Enterprise in the debug mode and open the customer form.
- In the Address field, type n.
The platform suggests two cities starting with this letter (fig. 27.25).
Fig. 27.25. Selecting from a set of predefined values in a text box
The operations that you performed in Designer are also available in 1C:Enterprise script. This means that you can use some algorithm for dynamic generation of a selection list for a text box.
Moreover, you can use 1C:Enterprise script to modify an automatically generated selection list (for example, a selection list in an automatically generated form). To do so, use the ChoiceDataGetProcessing event handler that is located in the object manager module. For example, to implement picking a catalog item in a text box, you can put the event handler to the catalog manager module.