Events

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

Event

Description

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'); } });