Reading Time: 1 minute

Sets an event listener.


vcc.setEventListener(page: string|null, controller: string|null, event: string, callback: Function): void

You can set script event listeners programmatically. For setting static listeners, it is easier to use the dollar-sign notation.

Note: Use this function within an event.


Page name.

Unique ID of the control within the datasheet or script page.

The name of the event.

The function which will handle the event.

Return values



You have multiple similar pages, each starting with the characters ‘q4_’. You also have fields with identical names. You want to load the pages only if the export value of the related (connected) field is “allowed”. You can do this by writing lots of dollar-sign notation events, but you can also achieve the same result in one step instead.

Note: There can be only one listener for each event. If you previously set something, it will be replaced by setting another one.

vcc.getScriptPages().forEach(function(page) {
    if ('q4_' === page.substr(0, 3)) {
        vcc.setEventListener(page, null, 'checkBeforeLoad', function() {
            return vcc.isSelected(page, 'allowed', 'export_value');

There are no comments yet.
Subscribe to our newsletter
or Contact us!
Please note that by subscribing to our newsletter, you agree to receive regular email messages from VCC Live® about service related news and updates. By subscribing to our newsletter, you also agree that VCC Live® will use your data in accordance with the applicable Privacy Policy until you unsubscribe from the newsletter.

Privacy Settings Center


Necessary cookies are essential in order to navigate around a website and use its basic features. You must accept these cookies as the website cannot function properly without them.



Marketing cookies are used to track visitors across websites and deliver advertisements that are more relevant and engaging to you.



Statistic cookies collect data to help us understand how visitors use our websites and are used to improve the user experience. These cookies don’t collect personal information and cannot identify visitors.



Other cookies are those cookies that do not fall into the categories above. These cookies are in the process of being classified.