Skip to main content

webEvent

webEvent : object

ParameterTypeDescription
Resultobject<-object

Description

webEvent returns an object with information on a triggered event linked to a Page component.

The command must be called in the context of a Page handled by the Qodly web server.

Result

The returned object contains the following properties:

PropertyTypeDescription
callerstringServer-side reference of the component triggering the event
eventTypestringType of event:
  • onblur
  • onfocus
  • onclick
  • onauxclick
  • onmouseenter
  • onmouseleave
  • onkeyup
  • onkeydown
  • onchange
  • unload
  • onload - triggered when the Page loads
  • dataobjectAdditional information depending on the involved component
    indexnumber
  • Tabs component: index of the tab (indexing starts at 0)
  • Data Table component: column number
  • rownumberData Table component: row number
    namestringData Table component: qodlysource name of the column (e.g. "firstname", "address.city")

    Example

    The objective is to display/hide a help text when the user hovers over the component:

    alt-text

    This is done by attaching onmouseenter and onmouseleave events to a Text input component that displays the information stored in a Text component (displaying "This is the help").

    alt-text

    In this scenario:

    • The Text input component has orderNumber as Server side reference. alt-text
    • The Text component has orderNumber as Server side reference. alt-text
    • The exposed function help() is attached to both the onmouseenter and onmouseleave events and contains the following code:
    exposed function help()

    var event : object
    var myForm : 4D.WebForm
    var componentRef : string

    myForm = webForm
    event = webEvent
    componentRef = event.caller

    switch
    : (event.eventType == "onmouseenter") // event is onmouseenter
    myForm["helpOn_"+componentRef].show() // show the help on "orderNumber" by showing
    // the text component with reference "helpOn_orderNumber"
    : (event.eventType == "onmouseleave") // event is onmouseleave
    myForm["helpOn_"+componentRef].hide() // hide the help on orderNumber
    end

    To open the Page with the help on orderNumber hidden, you can associate this function to the onload event of the Page:

    exposed function hideOnLoad()
    webForm.helpOn_orderNumber.hide()