Skip to content
Developerhome

onLoad Event - Properties

  Less than to read

The onLoad event is a powerful tool that allows you to perform various tasks and customize the behaviour of your Sage 200 screens when they are initially loaded. One common use case is to set properties for specific components on the page. This allows you to enable or disable fields, modify their visibility, or make other changes based on your requirements.

Let’s explore an example where we want to set properties using the onLoad event.

  "events": [
    {
      "onLoad": [
        {
          "set": {
            "properties": {
              "spare_text_1": {
                "disabled": false
              }
            }
          }
        }
      ]
    }
  ]

In the given example, the onLoad event is used to set properties for a specific component, which in this case is “spare_text_1”. The properties are defined within the properties object, and the desired changes are specified using key-value pairs.

In this specific case, the property being modified is “disabled”, and it is set to false. Let’s break down the meaning and implications of this property:

disabled: By setting this property to false, we are enabling the field. This means that the “spare_text_1” field will be interactive and can be edited or interacted with by the user. If the disabled property were set to true, the field would be disabled, preventing any user interaction or modification. It’s important to note that the properties object can contain multiple key-value pairs, allowing you to modify multiple properties of the component simultaneously. In this case, only the “disabled” property is modified, but you can add more properties within the properties object as needed.

To explore all the available properties for a specific component, please refer to the web Schema for comprehensive documentation.