Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Current »

Here is a list of custom events that can be listened for:

Event

Description

field-validation

Emitted on the blur event when the user types.

field-tokenization

Emitted when a field attempts to tokenize on the Netvalve server.

field-initiated

Emitted when the input inside the iframe has finished rendering.

Example usage

// Listen for validation events
window.addEventListener('field-validation', (event) => {
    const { success, message, fieldName } = event.detail;
    if (!success) {
        console.log(`Validation failed for ${fieldName}: ${message}`);
    }
});
// Listen for tokenization events
window.addEventListener('field-tokenization', (event) => {
    const { success, message, fieldName } = event.detail;
    if (success) {
        console.log(`${fieldName} successfully tokenized`);
    } else {
        console.log(`Failed to tokenize ${fieldName}: ${message}`);
    }
});
// Listen for initialization
window.addEventListener('field-initiated', (event) => {
    const { success, message } = event.detail;
    if (success) {
        console.log('TokenFieldSDK initialized successfully');
    }
});
  • No labels