G_FORM Cheat Sheet

Client scripts can be called 

  1. alert('Message'); // To Debug the client script.
  2. g_form.addDecoration('field to add icon to','icon', 'icon label');
    // add an icon from the list of supported icons to the field urgency and the label for the icon.
  3. g_form.addErrorMessage('Something went wrong- Message');
    // add an error message in red with the preferred message.
  4. g_form.addInfoMessage('This is info messaage');
    // Add information message on the top with the message.
  5. g_form.addOption('urgency', '4','Very High Priority');
    // Add an option to the choice list with the value '4' and the display value 'Very High Priority'.
  6. g_form.clearMessages();
    // Clear all the messages that were displayed from addInfoMessage and addErrorMessage etc.,
  7. g_form.clearOptions('impact');
    // Clears all the choice values available, user will see only blank choice list.
  8. g_form.disableAttachments(); / g_form.enableAttachments();
    // enables or disables the attachment option.
  9. g_form.flash('urgency','red', '1');
    // flashes a color on the specified field, used to draw users attention.
  10. var x = g_form.getActionName();
    // returns the latest action name performed
  11. var x = g_form.getBooleanValue('fieldName');
    //Returns false if the field value is false or undefined, otherwise returns true.
  12.  var x = g_form.getControl('fieldName');
    //This is strictly used for mobile application only