MobileGlideForm (g_form) - addDecoration(String fieldName, String icon, String text)

Adds a decorative icon next to a field.

Table 1. Parameters
Name Type Description
fieldName String The field name.
icon String The font icon to show next to the field.
text String The text title for the icon (used for screen readers).
Table 2. Returns
TypeDescription
void

This example adds a VIP icon next to the caller.

function onChange(control, oldValue, newValue, isLoading) {
      // if the caller_id field is not present, then we can't add an icon anywhere
      if (!g_form.hasField('caller_id'))
          return;
      
      if (!newValue)
         return;
      
      g_form.getReference('caller_id', function(ref) {
      g_form.removeDecoration('caller_id', 'icon-star', 'VIP');
      
      if (ref.getValue('vip') == 'true')
           g_form.addDecoration('caller_id', 'icon-star', 'VIP');			
      });
      }