Return or set the current widget properties of an instance of a field.

$fieldproperties {(Field  {,PropertyList}) }

$fieldproperties {(Field  {,PropertyList}) } { = } PropertyValuesList

Example: $fieldproperties(GENDER) = "Frame=T;forecolor=blue"


Parameter Data Type Description
Field String Field name; optional. It can optionally contain a qualified field name, for example MYFLD.MYENT. If omitted, the current field is used.
PropertyList String Uniface list of widget property names, separated by GOLD ; (;); can be a string, or a variable, function, or parameter that evaluates to a string, or a field (or indirect reference to a field)
PropertyValuesList String Associative list of Property=PropertyValue pairs (separated by GOLD ; ), where PropertyValue is the value to be assigned to the property identified by Property. If PropertyList is present, only those properties in PropertyValuesList that are present in PropertyList are affected.

Return Values

  • Associative list of widget properties for the specified field in the current occurrence. Only properties that have been specified in PropertyList are returned.
  • Empty string ("") if no widget properties have been specified in PropertyList or if the field cannot be found.

If an error occurs, $procerror contains a negative value that identifies the exact error.

Values of $procerror Commonly Returned Following Field-Level ProcScript Functions
Value  Error constant Meaning
-1101 <UPROCERR_FIELD> An incorrect field name was provided; either the field name is not valid syntactically or the field is not available in the component.


Allowed in all component types except self-contained Services.


The function $fieldproperties returns or sets the dynamic widget properties for the specified field in the current occurrence. Only this single instance of the specified field is affected, and the properties remain in effect even when this occurrence is no longer the current occurrence.

$fieldproperties can only be used to set dynamic properties. (For more information about these properties, see the widget descriptions).

For each widget property, Uniface looks for it in the property string returned by $fieldproperties. If the property is not there, it is sought in the declarative properties, and finally in the .ini properties.

Restoring Default Property Values

Properties are reset to the compiled values (that is, the default properties, plus the properties set for the entity declaratively):

  • Each time that a component is restarted (assuming the Keep Data in Memory property is cleared)
  • Whenever all the properties in the component are reset with by actions such as clear and retrieve.

They are not reset by actions such as ^NEXT_FIELD or ^PREV_OCC.

If you have used $fieldproperties to change some property values, and you want to restore them to their defaults, you can use the following construction:


However, to restore only one specific property, you can remove it from the list as follows:

delitem/id $fieldproperties(vField),"BackColor"

Restoring Default Property Values in DSPs

In dynamic server pages (DSPs), it is possible to restore the default value of a property by preceding it with an exclamation mark:


For example:

$fieldproperties(COUNTRY) = "!style:background-color"

The default value is the value that the property had the first time webdefinitions was called. Thereafter, the default value is remembered by the browser and can no longer be changed.

Boilerplate Fields and $fieldproperties

The behavior of $fieldproperties for a field that is defined as boilerplate needs to be carefully considered. A boilerplate field is not a dynamic field that belongs to a particular occurrence in the component. Instead, it should be considered as a static graphical object that belongs to a position on the form where an occurrence can appear.

Consider the following example. Four occurrences of an entity are painted on a form. Each occurrence contains a boilerplate field, PIC1. PIC1 is a picture widget with Frame defined as Off. When the second occurrence has focus, the following statement places a frame around the image in the second occurrence:


As you scroll through multiple occurrences, the second occurrence on the screen always has the frame. Even after you clear data from the form, the frame definition remains for the second occurrence.

If PIC1 were not defined as boilerplate, setting the field properties affects only the current occurrence. As you scroll through multiple occurrences, the framed picture scrolls with the occurrence that was in the second position on the screen. After you clear data from the form, there is no longer a frame defined for the second occurrence.

$fieldproperties in a Web Application

Style references are stored as property values in the Repository, and can be manipulated with $fieldproperties and $properties. For dynamic changes to the look and feel of style attributes, use the subclass field-level property, which is checked at runtime and propagated through the generated HTML. The subclass property uses predefined style references from the Cascading Style Sheet (CSS) used by the Web application.

You can use subclass to provide visual clues for errors, and errormsg is used to provide detailed information on the nature of the error in a server page. To use $fieldproperties for this purpose, place it in the field-level error trigger.

subclass=MyClass can be substituted by, or used with, a specific error message using errormsg=My Error Message

For example, when used together, the syntax is:

$fieldproperties(Field)="subclass=MyClass;errormsg=My error message"

  • MyClass—predefined style class in the application’s CSS.
  • MyErrorMessage—message such as "Error in occurrence".

The syntax of $fieldproperties must not include spaces.

Note:  If the error trigger is empty, Uniface changes the default code from $text("%%$error") to $fieldproperties(Field)="errormsg=$text(%%$error), but only if the trigger has been fired due to a validation error for a field or key.

Highlighting the Field With Focus

The following sets properties for GENDER in the current occurrence when that field has focus. If more than one occurrence of the entity is drawn, only the field in the current occurrences has a frame around it and the text color set to blue. The frame and color are turned on in the getFocus trigger and turned off in the loseFocus trigger.

trigger getFocus ; of GENDER field
  $fieldproperties(GENDER) = "Frame=T;forecolor=blue"
trigger loseFocus
  $fieldproperties(GENDER) = "Frame=F;forecolor=black"

Related Topics