Skip to main content

Web Event

Web Form : Object

ParameterTypeDescription
ResultObject<-Object

Description#

Web Event returns an object with information on a triggered event linked to a webform component.

The function must be called in the context of a web form handled by the main 4D web server

The returned object contains the following properties:

PropertyTypeDescription
callerTextServer-side reference of the component triggering the event
eventTypeTextEvent type (onclick, onchange, onmouseover...)
dataObjectFor Tabs component: contains an index property (Number) with the index of the clicked Tab (indexing starts at 0)

eventType can contain the following events:

  • blur
  • focus
  • auxclick
  • click
  • dblclick
  • mouseenter
  • mouseleave
  • mouseover
  • keydown
  • keyup
  • change
  • On Load

The On Load event is triggered when the WebForm component loads.

Example#

The objective is to display help when the user hovers over the component:

alt-text

This is done by attaching an onmouseover event to an Input Text component that displays the information:

alt-text

In the above image:

  • The Text Input component has orderNumber as server reference
  • The component has an onmouseover event attached to it
  • The exposed function help attached to the onmouseover event contains the following code:
var $event : Objectvar $webForm : 4D.WebForm
$webForm:=Web Form$event:=Web Event$componentRef:=$event.caller
If ($event.eventType="onmouseover")  // event is onmouseover $webForm["helpOn_"+$componentRef].show()  // show the help on "orderNumber" by showing the text component with reference "helpOn_orderNumber" Else $webForm["helpOn_"+$componentRef].hide()  // hide the help on orderNumberEnd if