GlideForm - setVisible(String fieldName, Boolean display)

Displays or hides the field.

If the field is hidden, the space is left blank. This method cannot hide mandatory fields with no value.

Use UI Policy rather than this method whenever possible.

Table 1. Parameters
Name Type Description
fieldName String The field name.
display Boolean When true displays the field. When false hides the field.
Table 2. Returns
Type Description
void
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.setVisible('priority', false); 
      }
      else
         g_form.setVisible('priority', true); 
      }
   }