1Ci Support Help Center home page
Submit a request
Sign in
  1. 1Ci Support
  2. 1C:Enterprise Development Standards
  3. Designing user interfaces
  4. Implementation of form

Preventing editing table fields by condition

  • Implementation of form
    • Opening forms
    • Opening parameterized forms
    • Rules for creating form modules
    • Locking or independent opening of object forms
    • Modal windows use restrictions
    • Preventing editing table fields by condition
    • Specifics of spreadsheet document in a web client
    • Accessing automatically generated form controls from code
    • Accessing user form controls from code
    • Object modification commands
See more

Scope: managed applications.

Best practices

In some cases, you might need to inform users that the data entry is invalid or impossible until some required fields are filled in. To do so, employ the following approach.

  • To set up the warning, use the WarningOnEditRepresentation and WarningOnEdit properties.
  • Select the field in Designer and specify the warning text in the WarningOnEdit property.
  • Change the value of WarningOnEditRepresentation programmatically when the field is activated and the conditions change.
  • Grant users the right to edit table entries, including the ones that don't meet the conditions.

Example. The Costs form has a table with the CostItem and CostItemDimension fields. To fill in the CostItemDimension field, users have to specify CostItem first. The code sample for this use case:

&AtClient
Procedure SetWarningOnEdit() 
   If NOT ValueIsFilled(Items.Costs.CurrentData.CostItem) Then 
      If NOT ValueIsFilled(Items.Costs.CurrentData.CostItemDimension) Then
         Items.CostsCostItemDimension.WarningOnEditRepresentation =
 WarningOnEditRepresentation.Show;
      Else 
         Items.CostsCostItemDimension.WarningOnEditRepresentation=
           WarningOnEditRepresentation.DontShow;
      EndIf; 
   Else 
      Items.CostsCostItemDimension.WarningOnEditRepresentation= 
        WarningOnEditRepresentation.DontShow;
   EndIf;
EndProcedure

&AtClient
Procedure CostsOnActivateRow(Item)
   SetWarningOnEdit();
EndProcedure

&AtClient
Procedure CostsCostItemOnEdit(Item)
   SetWarningOnEdit()
EndProcedure

&AtClient
Procedure CostsCostItemDimensionOnEdit(Item)
   SetWarningOnEdit()
EndProcedure

If the warning text is also conditional, change the value of WarningOnEdit programmatically.

© 2020 1C INTERNATIONAL LLC www.1Ci.com Support policy