Web Event
Web Form : Object
Parameter | Type | Description | |
---|---|---|---|
Result | Object | <- | Object |
#
DescriptionWeb 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:
Property | Type | Description |
---|---|---|
caller | Text | Server-side reference of the component triggering the event |
eventType | Text | Event type (onclick, onchange, onmouseover...) |
data | Object | For 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.
#
ExampleThe objective is to display help when the user hovers over the component:
This is done by attaching an onmouseover
event to an Input Text component that displays the information:
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 theonmouseover
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