In Designer mode

Let us eliminate the shortages of the list form.

  1. In Designer, open the editor of the MaterialOptions catalog configuration object.
  2. On the Forms tab, in the List field, click the Open  button (fig. 15.14).

    Fig. 15.14. Creating a default list form
  3. In the wizard window that is opened, click Finish.

    This creates the default list form.

    Unlike the automatically generated form, the form created by the wizard does not include the Owner field. So your task is getting even simpler as you only need to hide the Code field.
  4. In the upper left pane of the form editor window, on the Elements tab, double-click the Form item.

    You have to double-click this item because the event that you need belongs to the entire form. This opens the form property palette.
  5. Scroll through the list of form properties to locate the OnCreateAtServer event and click its Open button (fig. 15.15).

    Fig. 15.15. Creating OnCreateAtServer form event handler

    This creates the OnCreateAtServer form event handler in the form module.
  6. Add the script shown in listing 15.1 to the event handler.

    Listing 15.1. OnCreateAtServer() form event handler

    If Parameters.Filter.Property("Owner") Then
        Items.Code.Visible = False;
    Let us review this code.

    Parameters is a property of the managed form where the module belongs. Using this property, you get the object that contains a collection of form parameters.

    The Filter item of this collection is called by its name. Using the Property() method of the filter item structure, you define whether a filter by the Owner field is applied.

    If the filter is applied, you set the Code field visibility to False, which hides the field. Here Items is a managed form property that provides access to all form items.
Next page: In 1C:Enterprise mode
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.