Telephone Formatting??

User 332337 Photo


Registered User
61 posts

Big fan of this piece of software - is there a way to do this?

Phone number input needed -
Verification needed -

But I need the form to be formatted so the person filling it out sees this:

( _ _ _ ) _ _ _ - _ _ _ _

and the numbers fill in as typed. Don't need the underscores - those are there to show digits allowed. Would really like to have the area code stick out for the visitor to fill in.

If I turn on verify - it seems to NOT like the parentheses??

Currently, when the form arrives it is difficult to read - 5552561324
User 122279 Photo


Senior Advisor
11,739 posts
Online Now

Hi, I don't know if you are US based or in some other country, but I want to make you aware that if the phone number is formatted to suit just one format, and if the phone number field is made mandatory, people from other countries will not be able to submit any form.

It depends of course on what use your form is for, and if you want or expect only people from one country to submit.

I cannot help you with the parantheses, but maybe Eric can ;)
Ha en riktig god dag!
Inger, Norway
My new honey site, built with RFF: http://www.horgenhonning.net/
Component sharing for RFF, RBB, RSD and SD: http://www.horgenhonning.net/sharing/


User 187934 Photo


Senior Advisor
18,175 posts

Hi K,
How about doing it automatically as they type?
http://ericrohloff.com/coffeecup/ccforu … to-format/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com
http://ericrohloff.com/property/
User 332337 Photo


Registered User
61 posts

OK - how did you do that... exactly what I am looking for!

US-based - and local or near local phone numbers needed... for a chicken barbeque vendor that caters.
User 332337 Photo


Registered User
61 posts

I'm looking at my form in Form Builder and NOT seeing this option, or am I and not knowing it????
User 332337 Photo


Registered User
61 posts

version 2.9 build 5507
User 187934 Photo


Senior Advisor
18,175 posts

Paste this into a HTML element on your form. Change the PhoneNum in my script to the name of your phone input.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script>var jQ = $.noConflict(true);
// version 1
jQ( document ).ready(function() {

jQ('input[name="PhoneNum"]').on("keyup paste", function() {
var input = this.value.replace(/[^0-9\(\)\s\-]/g, "");
var inputlen = input.length;
var numbers = this.value.replace(/\D/g,'');
var numberslen = numbers.length;
var newval = "";

for(var i=0;i<numberslen;i++){
if(i==0) newval="("+numbers[i];
else if(i==3) newval+=") "+numbers[i];
else if(i==6) newval+="-"+numbers[i];
else newval+=numbers[i];
}

if(inputlen>=1&&numberslen==0&&input[0]=="(") newval="(";
else if(inputlen>=6&&numberslen==3&&input[4]==")"&&input[5]==" ") newval+=") ";
else if(inputlen>=5&&numberslen==3&&input[4]==")") newval+=")";
else if(inputlen>=6&&numberslen==3&&input[5]==" ") newval+=" ";
else if(inputlen>=10&&numberslen==6&&input[9]=="-") newval+="-";

jQ(this).val(newval.substring(0,14));
});
});</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com
http://ericrohloff.com/property/
User 332337 Photo


Registered User
61 posts

Thank you - but as a "Magical" Element - why is this not doing it from within the builder???????
User 187934 Photo


Senior Advisor
18,175 posts

The magical is only on validation not correction.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com
http://ericrohloff.com/property/
User 332337 Photo


Registered User
61 posts

Your code solution is EXACTLY what was needed for my form - thank you, sir!!

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.