Events
Here is a list of custom events that can be listened for:
Event | Description |
---|---|
| Emitted on the |
| Emitted when a field attempts to tokenize on the Netvalve server. |
| 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');
}
});