Let us use the Services document as an example. Suppose that you do not want to use the default choice form of the Employees catalog for selecting a value in the Technician field and you want to use a custom form instead.
First you have to create this form.
- Open the editor of the Employees catalog configuration object and click the Forms tab.
This object has no forms at all. This means that all the catalog forms used in 1C:Enterprise mode (including the choice form) are generated automatically.
- Click Add (fig. 27.26).
Fig. 27.26. Creating an Employees catalog form
- In the form wizard that is opened, select Generic form and enter ChoiceForm for its name (fig. 27.27).
Fig. 27.27. Creating a generic form for the Employees catalog
- Click Finish.
The form has no controls or data because it is a generic form and you can populate it with data and controls as you want.
- On the Attributes tab, create a main form attribute named List with DynamicList type, and set its Main table property to Catalog.Employees (fig. 27.28).
Fig. 27.28. Creating a main form attribute
Attention! It is important that you select the Main attribute check box. If you skip this step, the form is unable to determine its data source.
- Drag the List attribute to the form controls window.
- When asked "Add columns to the table "List"?", click Yes.
This adds the List table, which contains a list of employees, to the form.
Now let us slightly modify the form appearance.
- In the form controls pane, expand the List table and delete the Code field.
Since the table has its own command bar, let us hide the form command bar.
- Right-click the root Form item, open its property palette, and then, in the CommandBarLocation field, select None (fig. 27.29).
Fig. 27.29. Specifying form properties
Next, let us enable selecting values from the table that contains the list of employees.
- In the List table property palette, select the ChoiceMode check box (fig. 27.30).
Fig. 27.30. Table properties
Finally, let us change the form title.
- In the form property palette, in the Title field, enter Select employees.
- Clear the AutoTitle check box.
This prohibits displaying the extended presentation of the Employees catalog as the form title (fig. 27.31).
Fig. 27.31. Specifying form properties
So you have created a form that is very similar to the choice form. You have removed the Code field from the list and modified the form title to make it different from the choice form.
Obviously in reality generic form functionality should be different from that of the choice form because otherwise making it the choice form does not make sense. But this is beyond your current task. The only thing we want to demonstrate is how a generic form is used as a choice form.
- Open the configuration object editor for the Services document.
- Open the property palette of the Technician attribute and click the selection button in the Selection Form field.
This opens a list of custom forms created in the configuration for the object referenced by this attribute. The Tecnhician attribute references the Employees catalog, which has a single custom form: ChoiceForm.
- Select ChoiceForm (fig. 27.32).
Fig. 27.32. Specifying a choice form for a reference attribute