Jump to content

JavaScript Phone Formatting - Add Extension


Recommended Posts

I have the Javascript in our submission form to format the phone numbers to this format: (123) 456-7890, but sometime I need to add an extension to that. Is there a way to edit the Javascript so that I have the option to have it look like this: (123) 456-7890 x123. I don't want to have a separate column in the table to add an extension because they aren't always there and it will show up funny in the results tables. 

 

Any thoughts?

 

:)

Link to comment
Share on other sites

Thanks May, can you explain the HTML option a bit more. Essentially we have contact listed in a tabular report page usually with just phone numbers, occassionally those phone numbers have extensions. What I would like is to either have the extension directly in the phone number field or to have a column in the table that is labled EXT. that disappears when that information is blank for all information pulled into the table. I need the extension information to show up once they click details if there is one.

 

Thanks for all your help!

Link to comment
Share on other sites

  • 5 years later...
  • 8 months later...

Hi All - In relation to Caspio's new feature of Worldwide SMS Notifications, if you would like your input phone number fields to be automatically formatted - you can use the International Telephone Input plugin. This JavaScript plugin is used for entering and validating international telephone numbers. It adds a flag dropdown to any input, detects the user's country, displays a relevant placeholder, and provides formatting/validation methods. To know more of the customization, you can check this link: https://github.com/jackocnr/intl-tel-input

Here's a sample result in DataPage:

image.png

After submission in table:

image.png

Related articles:

https://howto.caspio.com/notifications/sms-notifications/configuring-the-sms-enabled-countries/
https://howto.caspio.com/release-notes/caspio-32-0/

Hope it helps!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...