Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

IBAN validation

Avatar

Level 3

Is there a way to validate an IBAN number within LiveCycle Designer using Javascript and/or FormCalc?

i found this website: https://github.com/arhs/iban.js

where they have a javascript solution, but i don't know how to get it to work in Livecycle designer.

Can anyone help me?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If you take the code from GitHub and add it to a script object and add the following code to the same script object

var exports = {};


function IBAN()

{

    return exports;

}

 

You will be able to call the code using (assume the script object is called GitHib)

console.println(GitHub.IBAN().isValid('BE68539007547034'));

console.println(GitHub.IBAN().isValid('BE68539007547035'));

console.println(GitHub.IBAN().isValidBBAN('BE', '539-0075470-34'));

console.println(GitHub.IBAN().electronicFormat('BE68539007547034'));

console.println(GitHub.IBAN().electronicFormat('BE68 5390 0754 7034'));

console.println(GitHub.IBAN().printFormat('BE68539007547034'));

console.println(GitHub.IBAN().printFormat('BE68 5390 0754 7034'));

console.println(GitHub.IBAN().toBBAN('BE68 5390 0754 7034', '-'));

console.println(GitHub.IBAN().toBBAN('BE68 5390 0754 7034'));

console.println(GitHub.IBAN().fromBBAN('BE', '539007547034'));

                   

Similar to the GitHib example in HTML but we have to reference the script object and IBAN as a function.

Here is my sample checking this works https://sites.google.com/site/livecycledesignercookbooks/home/IBAN.pdf?attredirects=0&d=1

Regards

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

If you take the code from GitHub and add it to a script object and add the following code to the same script object

var exports = {};


function IBAN()

{

    return exports;

}

 

You will be able to call the code using (assume the script object is called GitHib)

console.println(GitHub.IBAN().isValid('BE68539007547034'));

console.println(GitHub.IBAN().isValid('BE68539007547035'));

console.println(GitHub.IBAN().isValidBBAN('BE', '539-0075470-34'));

console.println(GitHub.IBAN().electronicFormat('BE68539007547034'));

console.println(GitHub.IBAN().electronicFormat('BE68 5390 0754 7034'));

console.println(GitHub.IBAN().printFormat('BE68539007547034'));

console.println(GitHub.IBAN().printFormat('BE68 5390 0754 7034'));

console.println(GitHub.IBAN().toBBAN('BE68 5390 0754 7034', '-'));

console.println(GitHub.IBAN().toBBAN('BE68 5390 0754 7034'));

console.println(GitHub.IBAN().fromBBAN('BE', '539007547034'));

                   

Similar to the GitHib example in HTML but we have to reference the script object and IBAN as a function.

Here is my sample checking this works https://sites.google.com/site/livecycledesignercookbooks/home/IBAN.pdf?attredirects=0&d=1

Regards

Bruce

Avatar

Level 3

Bruce,

Thank you for your answer.

I've got it working.

Only my Avast Virus scanner goes crazy on your sample.

Tels me it contains an infection: JS:Pdfka-gen [Expl]

You may want to scan your computer.

Regards,

Sebas