Phone field formatting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2008 05:28 PM
I'm getting a little stuck with the phone number fields on a user record. Where does the formatting for these fields kick in? As an Aussie company, my users are getting a little confused no matter what they enter, the field auto formats to American: (xxx) xxxx-xxxx.
I've checked the personalise options on the field but can't find what I'm looking for. Been wikiing around without much luck.
Thanks in advance.
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2008 07:35 AM
This is a client script that is built into the code so it can't be modified. Here's the code.
function formatPhone(field) {
field.value = trim(field.value);
var ov = field.value;
var v = "";
var x = -1;
// is this phone number 'escaped' by a leading plus?
if (0 < ov.length && '+' != ov.charAt(0)) { // format it
// count number of digits
var n = 0;
if ('1' == ov.charAt(0)) { // skip it
ov = ov.substring(1, ov.length);
}
for (i = 0; i < ov.length; i++) {
var ch = ov.charAt(i);
// build up formatted number
if (ch >= '0' && ch <= '9') {
if (n == 0) v += "(";
else if (n == 3) v += ") ";
else if (n == 6) v += "-";
v += ch;
n++;
}
// check for extension type section;
// are spaces, dots, dashes and parentheses the only valid non-digits in a phone number?
if (! (ch >= '0' && ch <= '9') && ch != ' ' && ch != '-' && ch != '.' && ch != '(' && ch != ')') {
x = i;
break;
}
}
// add the extension
if (x >= 0) v += " " + ov.substring(x, ov.length);
// if we recognize the number, then format it
if (n == 10 && v.length <= 40) field.value = v;
}
return true;
}
You should submit an enhancement request. We might be able to move this logic to somewhere admins can modify or just provide a selection of options for type of phone formatting. Since we have been adding international language and currency support it makes sense to add this as well.
Another option, or short term solution is to create new string fields to avoid the default formatting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2009 03:46 PM
I would like to second the request for phone number formatting to be optional (or re-programmable).
The current format does not make sense in Australia (or many non-US countries). As a quick measure it would be good to at least have the ability to turn this off.
If you were really keen to add some longer term value beyond just phone formatting - an ability to use complex formatting using a printf style structure would be great (http://en.wikipedia.org/wiki/Printf#printf_format_placeholders)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2009 03:58 PM
You could try changing the field to a String to remove the formatting. If it won't let you, disable the UI Policy preventing change of the internal_type field on sys_dictionary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2009 02:29 PM
It's been long enough now I guess my users are used to the North American format; even though it's not correct. I think it's best I hold off to a stable or full release to address this issue, rather than start hacking sys_dictionary. A possible "cleaner" solution would be to create a u_phone string field on the table and use that for phone number storage until the system phone field is corrected.
This issue was raised as PRB42442. The system shouldn't refer to the language field to drive phone format as suggested on the problem ticket however - format is based on country, and Aussies would be using either "en" or "en-GB" for system language.