SinJunYoung Posted August 30, 2019 Report Share Posted August 30, 2019 <SCRIPT LANGUAGE="JavaScript"> var arrEl = Array.from(document.querySelectorAll('#InsertRecordMobile_, #InsertRecordHome_Telephone_')); let regExp = /^[0-9]+$/; arrEl.forEach(function(el) { el.maxLength = 14; el.addEventListener('input', function(v_e) { if (regExp.test(v_e.key)) { this.value = this.value.substr(0, this.value.length - 1); return false; } let v_value = (this.value.replace(/[^\d]/g, '')); console.log(v_value, this.value); if (v_value.length >= 7 && v_value.length < 10) { this.value = (v_value.substring(0, 3) + "-" + v_value.substring(3, 7) + v_value.substring(7, v_value.length)); } else if (v_value.length >= 10) { this.value = ("(" + v_value.substring(0, 3) + ") " + v_value.substring(3, 6) + "-" + v_value.substring(6, 10) +v_value.substring(10, v_value.length)); } }); }); </SCRIPT> This script is from the link: I just want to share that the blue colored text are the ID of the fields in your current DataPage where you can apply this code. Quote Link to comment Share on other sites More sharing options...
Kurumi Posted September 2, 2019 Report Share Posted September 2, 2019 The ID Elements will depend on the DataPage you are using. You can this post for more information: Quote Link to comment Share on other sites More sharing options...
Kurumi Posted October 25, 2021 Report Share Posted October 25, 2021 Hi! Just an update on this, Caspio has a new Tech Tip called: Format Phone Number in DataPages. You may visit it here: https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/format-phone-number-in-datapages/ Hope it helps! Quote Link to comment Share on other sites More sharing options...
Kurumi Posted July 15, 2022 Report Share Posted July 15, 2022 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: After submission in table: 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.