HTML event handlers

HTML events occur in a client's web browser when a user moves, clicks and drags the mouse, enters text, and performs other interactions. HTML components, such as text boxes or picklists, can expose JavaScript handlers to be invoked when these events occur. You can read more about HTML events at this recommended web site: http://www.w3schools.com/js/js_events_examples.asp

Using event handlers, you can customize the behavior of your HTML components. In the example below, the pair of handlers named onfocus and onblur for Text Areas will expand a component to eight rows when it receives focus (onfocus) and then compress it to two rows when it loses focus (onblur):

As shown, the this reference can be used inside event handlers to access or modify the properties of the relevant input field.

Tips for writing event handling scripts:

  • You cannot use form in a Page's onload script. Instead, note that the HTML form used to edit or create an object record is always named theForm.
  • A good practice is to verify that the JavaScript function you are calling exists on the current page.
  • Use prefixes to avoid naming conflicts. Note that Platform JavaScript system functions have the prefix rbf_ and system variables have the prefix rbv_.
  • Keep in mind that disabled HTML controls do not send values upon HTML form submit.
  • It is important to use the integration code of the selected picklist option rather than the field itself in formulas. That field is replaced with a system-generated ID that is different from installation to installation, so you cannot rely on it in formulas when publishing your application.