Initializing help system before first use

Working with DOM Events

You can attach HTML event handlers to VDL and HTML tags using the <vdl-event> element.

This is useful when you are building a user interface that needs to react to events other than those the core components provide.

A typical view can raise and respond to many events. Many are listed on the following page of the Mozilla documentation web site: https://developer.mozilla.org/en-US/docs/Web/Events.

You can intercept DOM events by providing the <vdl-event> element with one or more key-value pairs. Each pair is separated by a colon, the key is the event name and the value is a function reference. In this example, the keyup handler is assigned to the txtChange function.
<script>
    function txtChange(event) { console.log('keyUp fired'); }
</script>
<input id="txtbox" type="text" vdl-event="keyup:txtChange">
When several handlers need to be assigned to the same element, each key-value pair is separated by a comma:
<vdl-field entity="MyScalar" 
         vdl-event="click: fieldClick, blur:fieldBlur">
</vdl-field>
Here, the click handler is assigned to a function fieldClick and blur to a function called fieldBlur.
In general, when using event handlers in this way, the form of the call is:
function eventHandler( element, event ) { … }
In this example, element is the element object from the DOM that the handler was placed upon, and event is a jQuery event object.

© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.