What is the best way to get telephone numbers formatted upon entry?
Is there a telephone custom field extension, as there are for other formatted fields?
If not, what is EE convention? Multiple fields for each part? (Not very appealing.)
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
May 02, 2008 2:55pm
Subscribe [0]#1 / May 02, 2008 2:55pm
What is the best way to get telephone numbers formatted upon entry?
Is there a telephone custom field extension, as there are for other formatted fields?
If not, what is EE convention? Multiple fields for each part? (Not very appealing.)
#2 / May 02, 2008 4:03pm
seajay, there is no built-in way to validate or otherwise format the data on input. Having said hat, an extension and some javascript should be able to do that, but it’d be a custom soltuion.
#3 / May 02, 2008 4:11pm
Thanks. I thought that might be the case, but didn’t find a thread about either of those options, and was hoping ...
Since I’m not skilled to that degree, I guess you can close this thread. Sigh.
#4 / May 02, 2008 8:48pm
If you use a custom entry field for the telephone number you can style it using CSS.
Create a custom field, ie {telephone_number}, and set the field formatting to “none”
Add the tag to your template surrounded by an approriate HTML tag
{telephone_number}Now add a class and a style…
{telephone_number}
.telephone-number {font-weight: bold; color: #FF9900;}#5 / May 02, 2008 8:51pm
I was thinking about formatting, rather than styling.
For example, in the Control Panel, I would like to require people to enter as ...
+x-xxx-xxx-xxxx
... where X is a digit. Or, automatically rewriting a number into that format. Or another one.
But, this is not a showstopper. The thread can be closed.
#6 / May 03, 2008 3:30am
Your best bet is javascript. If you’re using the SAEF you could do it that way, if you use the backend, or want to check upon submission you’d need an etxension.
#7 / May 03, 2008 6:08am
#8 / May 03, 2008 9:10am
Thank you!
#9 / May 03, 2008 9:40am
No problem. There are some really nifty Javascript solutions going around at the moment for this type of thing.
Let us know how you get on.
Best wishes,
Mark