Saltar al contenido principal
Versión: 21 BETA

Web Event

Web Event : object

ParámetrosTipoDescripción
ResultadoObjectInformación sobre el evento activado

Descripción

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

The command must be called in the context of a web page handled by the 4D web server.

Resultado

El objeto devuelto contiene las siguientes propiedades:

PropiedadTipoDescripción
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
  • dataobjectInformación adicional en función del componente implicado
    indexnumber
  • Tabs component: index of the tab (indexing starts at 0)
  • Data Table component: column number
  • rownumberComponente de la tabla de datos: número de línea
    namestringData Table component: qodlysource name of the column (e.g. "firstname", "address.city")

    Ejemplo

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

    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 text").

    En este escenario:

    • The Text input component has orderNumber as Server side reference.
    • El componente Texto tiene helpOn_orderNumber como referencia del lado Servidor.
    • The exposed function help() is attached to both the onmouseenter and onmouseleave events and contains the following code:
    shared singleton Class constructor()
    exposed Function help()

    var event : Object
    var myForm : 4D.WebForm
    var componentRef : Text

    myForm:=web Form
    event:=web Event
    componentRef:=event.caller

    Case of
    : (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 case

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

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

    Ver también

    Web Form
    WebForm class
    WebFormItem class

    Propiedades

    Número de comando1734
    Hilo seguro