> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Validating iframes

Access to iframe field data is restricted, but you can validate iframe fields in a several ways:

* Inside your own merchant validation function at submit
* As blur events occur when the user tabs from field to field in the iframes
* As a call to `vindicia.isValid()` for all iframes or for a single iframe
* Let the **Submit** button block naturally if iframe fields do not contain valid data

| vindicia.cardType | A string property to hold the short name of the card type that was detected. Supported values include - amex - dankort - diners\_club\_carte\_blanche - diners\_club\_international - discover - jcb - visa\_electron - visa - mastercard - maestro This is available only with the `CardNumber` iframe. |
| - | - |
| vindicia.dataLength(selector) | This method returns a positive integer that is a count of characters inside the input box in the iframe. If no selector is specified, or if the selector cannot find the iframe, it returns zero. This is very useful when detecting if the card is an "amex" and in the CVV field four numbers were entered `if (vindicia .cardType == "amex" && vindicia.dataLength('vin_PaymentMethod_nameValues_cvn') != 4) &#123; alert("American Express CVV must be 4 numbers"); return false &#125;` |
| vindicia.isValid(selector) | This method returns true or false if the input box in the iframe is valid. If no selector is specified, it returns true if all iframes are valid, and false if at least one iframe is not valid. `if (!vindicia.isValid('vin_PaymentMethod_creditCard_account')) &#123; alert('Please enter a valid credit card before submitting'); return false &#125;` |

```

 Accessing onblur events with vindicia.setup()

 onVindiciaFieldEvent: function(event) {
 if (event.detail.fieldType == 'cardNumber') {
 setCardImage(event.detail.cardType); // bright or dim the card logo
 }
 if (event.detail.fieldType == 'expirationDate') {
 if (!event.detail.isValid)
 {
 console.log('vindiciaFieldEvent expirationDate not valid');
 }
 }
 },
```

**Parent topic:**[Implementing HOA with Hosted Fields](../topics/Implementing_HOA_with_Ho)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.