Show TOC

Event Validation (Client Eventing)Locate this document in the navigation structure

Definition

This non visible component is necessary for the client side eventing. Client side eventing is a Portal service (See EPCF for more details) that allows event driven manipulations on the web client without causing a server event. The eventValidationComponent inherits from the Component component.

Typical client side event tasks are validation of input fields, for example, validating a date or number format. For easier use of the client side event service in combination with HTMLB the client side eventing functions have been integrated into the HTMLB API. All components that support client side eventing (like button, checkBox and inputField) inherit from this component.

  • clientEvent

    Defines the event trigger and the event handler for client side event handling. Following event triggers are possible:

    • ON_BLUR

      The blur event is fired, when a component, for example, an inputField, looses the focus.

    • ON_CHANGE

      The change event is fired, after the ON_BLUR event and if the value of the component had been changed (for example, you changes the value of an inputField).

    • ON_CLICK

      The click event is fired, when a component that can be clicked, like a button or checkbox, has been clicked.

    • ON_FOCUS

      The focus event is fired, when a component, for example, an inputField, gets the focus (for example, by clicking into the inputField).

    • ON_FORM_SUBMIT

      The form submit event is fired, when the submit button has been clicked and before the form is sent to the server. This event gives you the opportunity to validate the form before it is sent to the server.

    • ON_KEYDOWN

      The key down event is fired, when any key, including function keys, on the keyboard is pressed. When you define an ON_KEYPRESS and an ON_KEYDOWN event trigger, the ON_KEYDOWN event handler is called first. When this event handler is finished, the ON_KEYPRESS event handler is called.

    • ON_KEYPRESS

      The key press event is fired, when a ASCII key, no function key, on the keyboard is pressed. When you define an ON_KEYPRESS and an ON_KEYDOWN event trigger, the ON_KEYDOWN event handler is called first. When this event handler is finished, the ON_KEYPRESS event handler is called.

    • ON_KEYUP

      The key up event is fired, when the pressed key is released again.

    • ON_TIMEOUT

      The time out event is fired, when a time out occurs.

    • ON_VALIDATION

      The validation event is fired, before the validation of the component is called.

    The event trigger that can be used, depends on the component. For example, a ON_TIMEOUT event is not possible for a button.

  • enabled

    A boolean value that defines if the component is enabled (= true) or disabled (= false). A disabled component fires no event and usually has a different color.

  • errorText

    Defines the error message that is displayed if the validation is negative.

  • requiresValidation

    A boolean value that defines that the component has to be validated (requiresValidation = true) before a server event is fired.

  • serverEvent

    Defines the event trigger and the event for event handling by the server. Events are for example, BreadCrumbClickEvent, ButtonClickEvent and so on. Refer to the HTMLB Javadoc description - Class "Event" for available HTMLB events.

  • validator

    Defines an application specific validator for a component. If you specify a null value as validator argument, the validator is removed for the component. Validators are for example, CancelButtonValidator, DataTypeValidator, LengthValidator and RequiredValidator. Refer to the HTMLB Javadoc description - Class "Validator" for more details.

Attributes

M

Values

Usage

clientEvent

String (cs)

Taglib

No tag available

Classlib

setClientEvent(EventTrigger.ON_FOCUS, "onFocus")

enabled

FALSE (d)

TRUE

Taglib

No tag available

Classlib

setEnabled(true)

errorText

String

Taglib

No tag available

Classlib

setErrorText("invalid date")

requiresValidation

FALSE (d)

TRUE

Taglib

No tag available

Classlib

setRequiresValidation(true)

serverEvent

Taglib

No tag available

Classlib

setServerEvent (EventTrigger.ON_FOCUS, Event ev)

validator

Taglib

No tag available

Classlib

setValidator (Validator validator)

The following example demonstrates the set up for client side eventing with an inputField component. The "jsObjectNeeded" attribute is inherited from the Component component.

Example

using the taglib

  <hbj:inputField 
    id="currencyDisplay" 
    type="BCD" 
    width="250px" 
    value="100" 
    jsObjectNeeded="true">
    currencyDisplay.setClientEvent(EventTrigger.ON_CHANGE, 
                                   "calculateCurrencyToFrom()");
  </hbj:inputField>

         

using the classlib

    Form form = (Form) this.getForm();

    InputField inf2 = new InputField("currencyDisplay");
    inf2.setJsObjectNeeded(true);
    inf2.setClientEvent(EventTrigger.ON_CHANGE,
                       "calculateCurrencyToFrom()");
    inf2.setBCD("100");
    inf2.setWidth("250px");

    form.addComponent(inf2);