Masks and Formats

Good friends, it’s a pleasure to be participating and use this project as well as I have a question about how I can add masks and formats to the fields in the forms, for example: In the phone number that you send: (xxxx- xxxx), and likewise with the custom fields, my knowledge is basic in programming but I achieve the perfect code, this is my only drawback. Thankful for any kind of help, thank you.

Except for dates and numbers, all other information is saved in the database in text-type or varchar-type fields, with the same format that was used when entering the information in IP. For instance, if you type phone numbers with the format “xxx-xxx-xxx” or “(xxx)-xxx xx xx xx”, they will be saved, retrieved and displayed with that format in all html and pdf forms. This approach is good enough for most IP users.

But if you want to manipulate (validate, format, etc.) the information entered in a form before saving it in the database, or if you want to change the display format depending on some criteria, you will have to decide first whether to do it on the client side with JavaScript or on the server side with PHP, and then, to avoid reinventing the wheel I would recommend using a library.

For instance, for PHP I would suggest using brick/phonenumber, which is based on giggsey/libphonenumber, which in turn is a port of Google’s libphonenumber library to PHP. For JavaScript you can directly use Google’s library.