Validate

This function will validate specified value using specified validator.

Syntax

Validate("validatorName","value");
Validate("validatorName","value","countryCode");

Function arguments

  • validatorName – (String) The name of the validation protocol to be used. Allowed values: [ NONE | REGEX | PL_PESEL | PL_NIP | PL_REGON | PL_IBAN | PL_POSTAL | PLDowodOsobisty | DE_STEUERIDENTIFIKATION | DE_RENTENVERSICHERUNGS | DE_AUSWEISNUMMEROLD | DE_UMSATZSTEUERID | DE_BETRIEBSNUMMER | DE_IBAN | E_MAIL | DATETIME | EU_NIP | IBAN ]
  • value – (String) The value to be validated
  • countryCode – (String) [Optional] ONLY WHEN USING 'EU_NIP’ VALIDATOR. NIP Country code. If not specified, then first two chars of NIP stored in 'value’ should be the CountryCode (ie. 'PL123456789′)’

Return value

This function returns Boolean.
Returns true if validation was successful, false otherwise

Examples

Example 1:
This will check if specified value is an valid email address, and in this case, return true.

isValid = Validate("E_MAIL","john@doe.pl");

Example 2:
This will validate wheter specified VAT (NIP) with CountryCode specified as its first two chars is an valid EU_NIP according to VIES database.

if(Validate("EU_NIP","PL123456789"))
{
ShowMessage(2,"OK");
}
else
{
ShowMessage(1,"NOT_OK");
}

Example 3:
This will validate wheter specified VAT (NIP) with CountryCode specified separately is an valid EU_NIP according to VIES database.

if(Validate("EU_NIP","123456789","PL"))
{
ShowMessage(2,"OK");
}
else
{
ShowMessage(1,"NOT_OK");
}

Example 4:
This will validate wheter specified VAT (NIP) with CountryCode specified separately is an valid EU_NIP according to VIES database.

if(Validate("EU_NIP",[nip],[countrycode]))
{
ShowMessage(2,"OK");
}
else
{
ShowMessage(1,"NOT_OK");
}
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.