GlideForm.js is the JavaScript class containing the methods. The global object g_form is used to access GlideForm methods. GlideForm methods are only used on the client. Or g_form.addOption dynamically display the choices in my select box field.
addDecoration(fieldName, String icon, String title)
g_form.addDecoration('requested_for', 'icon-star', 'preferred member');
Displays the specified error message at the top of the form.
g_form.addFormMessage('info message','info'); g_form.addFormMessage('error message','error'); g_form.addFormMessage('info2 message','info'); g_form.addFormMessage('warning2 message','warning'); g_form.addFormMessage('error2 message','error'); g_form.addFormMessage('warning message','warning');
IMAGE Here
addOption(String fieldName, String choiceValue, String choiceLabel)
g_form.addOption('priority', '6', '6 - Really Low');
clearMessages()
1. g_form.clearMessages();
disableAttachments() (Prevents file attachments from being added.)
enableAttachments() (Allows file attachments to be added. Shows the paper clip icon.)
Flashes the specified color for a specified duration of time in the specified field.
g_form.flash("number", "#FFFACD", 0);
Returns the most recent action name, or, for a client script, the sys_id of the UI action clicked.
function onSubmit() { var action = g_form.getActionName(); alert('You pressed ' + action); }
How to get the display value from a form in the core UI
g_form.getDisplayBox('caller_id').value;
How to get the display value from a form
g_form.getDisplayValue();
How to Returns the HTML element for the form
g_form.getFormElement()
How to Returns the HTML element of the help text for the specified field.
g_form.getHelpTextControl(String fieldName)
How to Returns the option element for a selected box named fieldName where choiceValue matches the option value.
g_form.getOption('category', choiceValue).text;
Returns an array of related list names from the current form.
var getListNames = g_form.getRelatedListNames();
for (var i = 0; i < getListNames.length; i++) {
this.showRelatedList(getListNames[i]);
}
Returns all section names, whether visible or not
g_form.getSections();
How to Returns an array of the form's sections.
function onChange(control, oldValue, newValue, isLoading) { var sections = g_form.getSections(); if (newValue == '3') { g_form.setSectionDisplay(sections[1], false); } else { g_form.setSectionDisplay(sections[1], true); } }
Returns true if the field is mandatory
g_form.isMandatory(String fieldName)