Form textbox with IBAN

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
woody-soft
User
Posts: 6
Joined: Fri Oct 14, 2011 6:13 pm

Form textbox with IBAN

Post by woody-soft »

Hi all,
is there a way to set a textbox with automatic Uppercase, and placeholders for a typical IBAN number?
i.e. every 4 characters a spacer like "XXXX XXXX XXXX XXXX XXXX"
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Form textbox with IBAN

Post by Tracker Supp-Stefan »

Hello woody-soft,

Actually IBAN numbers differ from country to country, so while there are some common elements - the length of those is not uniform.

You can set up "Format Value" options for a text form field, and could have "custom action" with JS code executed to handle the formatting of your field, but I do not have any samples of how this is done exactly, and you will likely need regular expressions as part of the formatting and validation of the user input!

This page might have some examples on custom scripts you could put in these two places:
image.png
Kind regards,
Stefan
woody-soft
User
Posts: 6
Joined: Fri Oct 14, 2011 6:13 pm

Re: Form textbox with IBAN

Post by woody-soft »

Thanks Stefan. Actually, I'm not concerned about the length (we only need to enter the german 22 chars in that particular PDF) and validation, just about automatic UPPERcase and that "4 chars - 1 space" sequence for easy entering of those strings. Someone with JS knowledge here? :)

Wouldn't it be cool, if PDFX would have that "automatic Uppercase" as a predefined action? (Similar to that "only numbers" option)

wOOdy
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Form textbox with IBAN

Post by Tracker Supp-Stefan »

Hello woody-soft,

I spent some time digging deep into JS - and almost got it to work writing my own code, but when I got stuck and asked a colleague from the dev team for help - it turned out it can be done pretty easily with just a few lines of code and some built in functions. Please see attached a sample file with the field included - you can copy and paste that filed in other files as needed.

The code is located in the Format Value -> Keystroke Action -> Run a JS part of the field's settings and is this one:

Code: Select all

if (!event.willCommit) {
    // Directly convert any lowercase letter input into uppercase as we type/paste
    event.change = event.change.toUpperCase();
    // format the value in the field as we type
    mask = "AA99 9999 9999 9999 9999 99";
    AFSpecial_KeystrokeEx(mask);
}
The mask is two letters followed by 20 digits, and if you want to allow any character - you can use X (e.g. XXXX XXXX XXXX XXXX XXXX XX to allow any symbol in any of the 22 positions).

Kind regards,
Stefan
Attachments
German_Iban.pdf
(4.96 KiB) Downloaded 35 times
woody-soft
User
Posts: 6
Joined: Fri Oct 14, 2011 6:13 pm

Re: Form textbox with IBAN

Post by woody-soft »

Hey Stefan,

works perfectly, Thank you very much!
(And I even learnt a bit or two ) :)

wOOdy
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Form textbox with IBAN

Post by Tracker Supp-Stefan »

Hello woody-soft,

Glad to hear it works for you!
I also learned quite a few things while looking at this problem!

Kind regards,
Stefan
msbask99
User
Posts: 27
Joined: Wed Jul 22, 2020 9:01 pm

Re: Form textbox with IBAN

Post by msbask99 »

I needed something similar and this post helped me immensely :D

Thanks!
User avatar
Dimitar - Tracker Supp
Site Admin
Posts: 1778
Joined: Mon Jan 15, 2018 9:01 am

Form textbox with IBAN

Post by Dimitar - Tracker Supp »

:)
Post Reply