Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

Display field messages

Log in to subscribe to topics and get notified when content changes.

Display field messages

Rather than use JavaScript alert(), for a cleaner look, you can display an error on the form itself. The methods showFieldMsg() and hideFieldMsg() can be used to display a message just below the field itself.

showFieldMsg and hideFieldMsg are methods that can be used with the g_form object.

These methods are used to change the form view of records (Incident, Problem, and Change forms). These methods may also be available in other client scripts, but must be tested to determine whether they work as expected.

When a field message is displayed on a form on load, the form scrolls to ensure that the field message is visible. Ensuring that users do not miss a field message because it was off the screen.

The global property glide.ui.scroll_to_message_field controls automatic message scrolling when the form field is offscreen (scrolls the form to the control or field).

Table 1. Method Detail
Method Detail Parameters Example
showFieldMsg(input, message, type, [scrollform])
  • input — name of the field or control
  • message — message you would like to appear
  • type — 'info', 'error', or 'warning'; defaults to info if not supplied
  • scroll form — (optional) Set scrollForm to false to prevent scrolling to the field message offscreen

Error Message

g_form.showFieldMsg('impact','Low impact not allowed with High priority','error');

Informational Message

g_form.showFieldMsg('impact','Low impact response time can be one week','info');
//or this defaults to info type
//g_form.showFieldMsg('impact','Low impact response time can be one week');

  • input — name of the field or control
  • clearAll — (optional) boolean parameter indicating whether to clear all messages. If true, all messages for the field are cleared. If false or empty, only the last message is removed.

Removing a Message

//this will clear the last message printed to the field

Legacy support

The showErrorBox() and hideErrorBox() are still available but simply call the new methods with type of error. You should use the new methods.