| Name | HTML attribute | Type | Description |
|---|---|---|---|
country
*
|
data-fv-vat___country
|
String
or
Function
|
An ISO-3166 country code |
message
|
data-fv-vat___message
|
String
|
The error message |
| Country | Abbreviation VAT system | Country code |
|---|---|---|
| Argentina | - | AR |
| Austria | UID | AT |
| Belgium | n° TVA / BTW-nr / Mwst-nr | BE |
| Brazil | CNPJ | BR |
| Bulgaria | ДДС номер | BG |
| Croatia | PDV-ID; OIB | HR |
| Cyprus | ΦΠΑ | CY |
| Czech Republic | DIČ | CZ |
| Denmark | CVR | DK |
| Estonia | KMKR | EE |
| Finland | ALV nro | FI |
| France | n° TVA | FR |
| Germany | USt-IdNr. | DE |
| Greece | ΑΦΜ | GR |
| Hungary | ANUM | HU |
| Iceland | VSK | IS |
| Ireland | VAT no | IE |
| Italy | P.IVA | IT |
| Latvia | PVN | LV |
| Lithuania | PVM kodas | LT |
| Luxembourg | No. TVA | LU |
| Malta | Vat No. | MT |
| Netherlands | Btw-nr. | NL |
| Norway | Orgnr | NO |
| Poland | NIP | PL |
| Portugal | NIF / NIPC | PT |
| Romania | CIF | RO |
| Russia | ИНН | RU |
| Serbia | PIB | RS |
| Slovakia | IČ DPH | SK |
| Slovenia | ID za DDV | SI |
| South Africa | - | ZA |
| Spain | NIF / CIF | ES |
| Sweden | Momsnr. | SE |
| Switzerland | MWST / TVA / IVA | CH |
| United Kingdom | VAT Reg No | GB |
| Venezuela | RIF | VE |
// You might need to change the importing path
import
vat
from
'formvalidation/dist/es6/validators/vat'
;
const
result
=
vat
(
)
.
validate
(
{
value
:
...
,
options
:
{
// Can be a string or a function returns a string
country
:
...
,
message
:
...
,
}
,
}
)
;
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/
// You might need to change the importing path
import
vat
from
'formvalidation/dist/es6/validators/vat'
;
const
res1
=
vat
(
)
.
validate
(
{
value
:
'U13585627'
,
options
:
{
country
:
'AT'
,
message
:
'The value is not a valid VAT number'
,
}
,
}
)
;
// res1.valid === true
const
res2
=
vat
(
)
.
validate
(
{
value
:
'13585627'
,
options
:
{
country
:
'DK'
,
message
:
'The value is not a valid VAT number'
,
}
,
}
)
;
// res2.valid === false
country
option isn't passed to the placeholder message