GlideForm - setDisplay(String fieldName, Boolean display)

Displays or hides a field.

This method cannot hide a mandatory field with no value. If the field is hidden, the space is used to display other items. Whenever possible, use a UI policy instead of this method.

Table 1. Parameters
Name Type Description
fieldname String Name of the field.
display Boolean When true displays the field, when false hides the field.
Table 2. Returns
Type Description

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   //If the page isn't loading
   if (!isLoading) {
      //If the new value isn't blank
      if (newValue != '') {
         g_form.setDisplay('priority', false);   
         g_form.setDisplay('priority', true);