ui.Form.setFieldStyle

Change the style of a form field.

Syntax

setFieldStyle(
   name STRING,
   style STRING )
  1. name defines the name of the form field, see Identifying elements in ui.Form methods.
  2. style is the set of style names to be used. Several style names can be combined, by using a space as separator.

Usage

Change the style of a form field with the setFieldStyle() method.

Pass the identifier of the form field, as defined in the form definition. The form field is identified by column name, with an optional prefix (table.column or column).

Depending on the attributes used in the style definition (.4st), changing the style of an element back and forth at runtime can lead to performance issues on the front-end side, when the style attribute results in complex rendering changes. As a general rule, consider modifying the style attribute once for the current form, before executing an interactive instruction (dialog). During a dialog, only change the style of leaf elements in the layout structure, such as labels, or small containers such as groups. Some style changes may not have any effect at all, when the GUI framework does not allow modifying the decoration once the widget is created.

Example

CALL DIALOG.getForm().setFieldStyle("customer.cust_name","mandatory")

In the above example, "mandatory" refers to a style name defined in your .4st file.